Skip to content

Commit cd670fb

Browse files
committed
Fix
1 parent e62557c commit cd670fb

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

config/polyfills.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
// import 'core-js/es6/reflect'
22
// import 'core-js/es7/reflect'
3+
4+
import 'tslib'

jest.config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"testPathIgnorePatterns": [
1717
"<rootDir>/node_modules/",
1818
"<rootDir>/dist/",
19-
"<rootDir>/public/"
19+
"<rootDir>/public/",
20+
"<rootDir>/config/"
2021
],
2122
"moduleNameMapper": {
2223
"\\.css$": "identity-obj-proxy"

webpack.config.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ module.exports = function (env = {}) {
1212
let outputFilename
1313
let plugins = []
1414
let moduleRules = []
15+
let cssModulesScopedName = '[path]___[name]__[local]___[hash:base64:5]'
1516

1617
////////////////////////////////////// output.filename
17-
outputFilename = env.production ? 'static/js/bundle.[hash].js' : 'static/js/[name].js'
18+
outputFilename = env.production ? 'static/js/bundle.[chunkhash].js' : 'static/js/[name].js'
1819

1920
////////////////////////////////////// plugins
2021
plugins.push(
@@ -30,7 +31,7 @@ module.exports = function (env = {}) {
3031
new CompressionWebpackPlugin({
3132
test: /\.js$/
3233
}),
33-
new ExtractTextPlugin('static/css/bundle.[hash].css')
34+
new ExtractTextPlugin('static/css/bundle.[chunkhash].css')
3435
)
3536
} else {
3637
// development
@@ -57,7 +58,7 @@ module.exports = function (env = {}) {
5758
[],
5859
plugins: [
5960
'transform-react-jsx',
60-
'react-css-modules',
61+
['react-css-modules', { generateScopedName: cssModulesScopedName }],
6162
]
6263
}
6364
},
@@ -77,7 +78,7 @@ module.exports = function (env = {}) {
7778
modules: true,
7879
importLoaders: 1,
7980
sourceMap: true,
80-
localIdentName: '[path]___[name]__[local]___[hash:base64:5]',
81+
localIdentName: cssModulesScopedName,
8182
}
8283
},
8384
'postcss-loader',
@@ -91,7 +92,7 @@ module.exports = function (env = {}) {
9192
modules: true,
9293
importLoaders: 1,
9394
sourceMap: true,
94-
localIdentName: '[path]___[name]__[local]___[hash:base64:5]',
95+
localIdentName: cssModulesScopedName,
9596
}
9697
},
9798
'postcss-loader',
@@ -101,7 +102,7 @@ module.exports = function (env = {}) {
101102

102103

103104
return {
104-
performance: false,
105+
context,
105106
entry: env.production ?
106107
// production
107108
['./config/polyfills.ts', './src/index.ts'] :
@@ -124,6 +125,7 @@ module.exports = function (env = {}) {
124125
},
125126
plugins,
126127
devtool: 'source-map',
128+
performance: false,
127129
}
128130

129131
}

0 commit comments

Comments
 (0)