commit: 499cc7b803fe6f9bddf0155b2e80cbb0fba4fb6d
parent: 7db98aa70e44c922bd13d72e78e0ae94826ad29f
Author: Naouak <tardiel@gmail.com>
Date: Tue, 30 May 2017 15:30:59 +0200
Fix webpack building on Windows (#3426)
* Path should not be constructed manually. Use path.join to ensure compatibility.
* Path should not be constructed manually. Use path.join to ensure compatibility.
* Fix regexp.
* Fix my own stupidity.
I forgot to check outside my test script the regexp...
Diffstat:
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/config/webpack/shared.js b/config/webpack/shared.js
@@ -4,7 +4,7 @@
/* eslint import/no-dynamic-require: 0 */
const webpack = require('webpack');
-const { basename, dirname, join, relative, resolve } = require('path');
+const { basename, dirname, join, relative, resolve, sep } = require('path');
const { sync } = require('glob');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
@@ -21,7 +21,7 @@ module.exports = {
(map, entry) => {
const localMap = map;
let namespace = relative(join(paths.source, paths.entry), dirname(entry));
- if (namespace === '../../../tmp/packs') {
+ if (namespace === join('..', '..', '..', 'tmp', 'packs')) {
namespace = ''; // generated by generateLocalePacks.js
}
localMap[join(namespace, basename(entry, extname(entry)))] = resolve(entry);
@@ -47,14 +47,15 @@ module.exports = {
new webpack.optimize.CommonsChunkPlugin({
name: 'common',
minChunks: (module, count) => {
- if (module.resource && /node_modules\/react-intl/.test(module.resource)) {
+ const reactIntlPathRegexp = new RegExp(`node_modules\\${sep}react-intl`);
+ if (module.resource && reactIntlPathRegexp.test(module.resource)) {
// skip react-intl because it's useless to put in the common chunk,
// e.g. because "shared" modules between zh-TW and zh-CN will never
// be loaded together
return false;
}
-
- if (module.resource && /node_modules\/font-awesome/.test(module.resource)) {
+ const fontAwesomePathRegexp = new RegExp(`node_modules\\${sep}font-awesome`);
+ if (module.resource && fontAwesomePathRegexp.test(module.resource)) {
// extract vendor css into common module
return true;
}