Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Revert webpack -p option; always resolve minified react version

Marcin Gębalaa2aea5ba817d
diff --git a/package.json b/package.json
index 1c04687132..ae605ee621 100644
--- a/package.json
+++ b/package.json
@@ -88,7 +88,7 @@
}
},
"scripts": {
- "build-assets": "node ./node_modules/webpack/bin/webpack.js",
+ "build-assets": "node ./node_modules/webpack/bin/webpack.js -p",
"heroku-postbuild": "yarn add --force node-sass && yarn run build-assets",
"start": "UV_THREADPOOL_SIZE=8 node ./node_modules/webpack/bin/webpack.js -d --watch"
}
diff --git a/webpack.config.js b/webpack.config.js
index 2c8bfaf9b1..3b5b82be2a 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -6,8 +6,9 @@ var webpack = require('webpack');
var resolve = path.resolve.bind(path, __dirname);
-var output;
var extractTextPlugin;
+var fileLoaderPath;
+var output;
if (process.env.NODE_ENV === 'production') {
output = {
@@ -15,6 +16,7 @@ if (process.env.NODE_ENV === 'production') {
filename: '[name].[chunkhash].js',
publicPath: '/'
};
+ fileLoaderPath = 'file?name=[name].[hash].[ext]';
extractTextPlugin = new ExtractTextPlugin('[name].[contenthash].css');
} else {
output = {
@@ -22,6 +24,7 @@ if (process.env.NODE_ENV === 'production') {
filename: '[name].js',
publicPath: '/static/assets/'
};
+ fileLoaderPath = 'file?name=[name].[ext]';
extractTextPlugin = new ExtractTextPlugin('[name].css');
}
@@ -86,7 +89,7 @@ var config = {
},
{
test: /\.(eot|otf|png|svg|jpg|ttf|woff|woff2)(\?v=[0-9.]+)?$/,
- loader: 'file?name=[name].[hash].[ext]',
+ loader: fileLoaderPath,
include: [
resolve('node_modules'),
resolve('saleor/static/fonts'),
@@ -109,7 +112,9 @@ var config = {
},
resolve: {
alias: {
- 'jquery': resolve('node_modules/jquery/dist/jquery.js')
+ 'jquery': resolve('node_modules/jquery/dist/jquery.js'),
+ 'react': resolve('node_modules/react/dist/react.min.js'),
+ 'react-dom': resolve('node_modules/react-dom/dist/react-dom.min.js')
}
},
sassLoader: {