about summary refs log tree commit diff
path: root/config/webpack
diff options
context:
space:
mode:
Diffstat (limited to 'config/webpack')
-rw-r--r--config/webpack/shared.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/config/webpack/shared.js b/config/webpack/shared.js
index 12e05dec2..1744353f7 100644
--- 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;
         }