mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
fix(webpack): Upgrade webpack to 4.x
This commit is contained in:
parent
7ed657df64
commit
ccc3354b04
@ -1,9 +1,8 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Unleash Admin</title>
|
||||
<title>Unleash DEVMODE</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="/static/bundle.css" />
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet">
|
||||
</head>
|
||||
|
@ -42,7 +42,7 @@
|
||||
"debug": "^3.1.0",
|
||||
"immutable": "^3.8.1",
|
||||
"normalize.css": "^8.0.0",
|
||||
"prop-types": "^15.6.0",
|
||||
"prop-types": "^15.6.2",
|
||||
"react": "^16.4.2",
|
||||
"react-dnd": "^5.0.0",
|
||||
"react-dnd-html5-backend": "^5.0.1",
|
||||
@ -58,7 +58,7 @@
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.14.0",
|
||||
"babel-eslint": "^8.0.2",
|
||||
"babel-loader": "^7.1.1",
|
||||
"babel-loader": "^7.1.5",
|
||||
"babel-plugin-transform-decorators-legacy": "^1.3.4",
|
||||
"babel-preset-es2015": "^6.14.0",
|
||||
"babel-preset-react": "^6.11.1",
|
||||
@ -73,10 +73,10 @@
|
||||
"eslint-config-finn-prettier": "^3.0.1",
|
||||
"eslint-config-finn-react": "^2.0.1",
|
||||
"eslint-plugin-react": "^7.10.0",
|
||||
"extract-text-webpack-plugin": "^3.0.0",
|
||||
"fetch-mock": "^6.0.0",
|
||||
"identity-obj-proxy": "^3.0.0",
|
||||
"jest": "^23.5.0",
|
||||
"mini-css-extract-plugin": "^0.4.1",
|
||||
"node-sass": "^4.5.3",
|
||||
"prettier": "^1.8.2",
|
||||
"react-test-renderer": "^16.2.0",
|
||||
@ -85,8 +85,9 @@
|
||||
"sass-loader": "^7.0.1",
|
||||
"style-loader": "^0.22.0",
|
||||
"toolbox-loader": "0.0.3",
|
||||
"webpack": "^3.1.0",
|
||||
"webpack-dev-server": "^2.6.1"
|
||||
"webpack": "^4.17.0",
|
||||
"webpack-cli": "^3.1.0",
|
||||
"webpack-dev-server": "^3.1.5"
|
||||
},
|
||||
"jest": {
|
||||
"moduleNameMapper": {
|
||||
|
@ -3,11 +3,16 @@
|
||||
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
const devMode = process.env.NODE_ENV !== 'production';
|
||||
const mode = process.env.NODE_ENV === 'production' ? 'production' : 'development';
|
||||
const entry = ['whatwg-fetch', './src/index'];
|
||||
const plugins = [
|
||||
new ExtractTextPlugin('bundle.css', { allChunks: true }),
|
||||
new MiniCssExtractPlugin({
|
||||
// Options similar to the same options in webpackOptions.output
|
||||
// both options are optional
|
||||
filename: 'bundle.css',
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': {
|
||||
NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development'),
|
||||
@ -16,13 +21,14 @@ const plugins = [
|
||||
new webpack.optimize.ModuleConcatenationPlugin(),
|
||||
];
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
if (devMode) {
|
||||
entry.push('webpack-dev-server/client?http://localhost:3000');
|
||||
entry.push('webpack/hot/only-dev-server');
|
||||
plugins.push(new webpack.HotModuleReplacementPlugin());
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
mode,
|
||||
entry,
|
||||
|
||||
resolve: {
|
||||
@ -45,31 +51,29 @@ module.exports = {
|
||||
},
|
||||
{
|
||||
test: /(\.scss)$/,
|
||||
loader: ExtractTextPlugin.extract({
|
||||
fallback: 'style-loader',
|
||||
use: [
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
modules: true,
|
||||
importLoaders: 1,
|
||||
localIdentName: '[name]__[local]___[hash:base64:5]',
|
||||
},
|
||||
use: [
|
||||
{ loader: devMode ? 'style-loader' : MiniCssExtractPlugin.loader },
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
modules: true,
|
||||
importLoaders: 1,
|
||||
localIdentName: '[name]__[local]___[hash:base64:5]',
|
||||
},
|
||||
{
|
||||
loader: 'sass-loader',
|
||||
options: {
|
||||
// data: '@import "theme/_config.scss";',
|
||||
includePaths: [path.resolve(__dirname, './src')],
|
||||
},
|
||||
},
|
||||
{
|
||||
loader: 'sass-loader',
|
||||
options: {
|
||||
// data: '@import "theme/_config.scss";',
|
||||
includePaths: [path.resolve(__dirname, './src')],
|
||||
},
|
||||
],
|
||||
}),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' }),
|
||||
test: /(\.css)$/,
|
||||
use: [{ loader: devMode ? 'style-loader' : MiniCssExtractPlugin.loader }, { loader: 'css-loader' }],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
1432
frontend/yarn.lock
1432
frontend/yarn.lock
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user