mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	Merge pull request #140 from Unleash/webpack4
fix(webpack): Upgrade webpack to 4.x
This commit is contained in:
		
						commit
						a17440c1c2
					
				@ -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,14 +42,14 @@
 | 
			
		||||
    "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",
 | 
			
		||||
    "react-dom": "^16.4.2",
 | 
			
		||||
    "react-mdl": "^1.11.0",
 | 
			
		||||
    "react-modal": "^3.1.13",
 | 
			
		||||
    "react-redux": "^5.0.6",
 | 
			
		||||
    "react-redux": "^5.0.7",
 | 
			
		||||
    "react-router-dom": "^4.3.1",
 | 
			
		||||
    "redux": "^4.0.0",
 | 
			
		||||
    "redux-thunk": "^2.1.0",
 | 
			
		||||
@ -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,20 +73,21 @@
 | 
			
		||||
    "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",
 | 
			
		||||
    "redux-devtools": "^3.3.1",
 | 
			
		||||
    "redux-devtools": "^3.4.1",
 | 
			
		||||
    "redux-mock-store": "^1.5.1",
 | 
			
		||||
    "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' }],
 | 
			
		||||
            },
 | 
			
		||||
        ],
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1458
									
								
								frontend/yarn.lock
									
									
									
									
									
								
							
							
						
						
									
										1458
									
								
								frontend/yarn.lock
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user