Skip to content

Commit a647dc3

Browse files
committed
junk: Kinda works but not really
1 parent e8ff2ec commit a647dc3

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

packages/cli/lib/lib/webpack/webpack-base-config.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -292,16 +292,9 @@ module.exports = function createBaseConfig(env) {
292292
new MiniCssExtractPlugin({
293293
filename:
294294
isProd && !env.isServer ? '[name].[contenthash:5].css' : '[name].css',
295-
chunkFilename: pathData => {
296-
const chunkId = /** @type {string} */ (pathData.chunk.id);
297-
const chunkName =
298-
typeof chunkId === 'string'
299-
? chunkId.split('_').slice(0, -1).join('-')
300-
: chunkId;
301-
return isProd
302-
? `${chunkName}.chunk.[chunkhash:5].css`
303-
: `${chunkName}.chunk.css`;
304-
},
295+
chunkFilename: isProd
296+
? '[name].chunk.[contenthash:5].css'
297+
: '[name].chunk.css',
305298
}),
306299
ProgressBarPlugin({
307300
format:
@@ -328,7 +321,6 @@ module.exports = function createBaseConfig(env) {
328321
},
329322
},
330323
}),
331-
isProd && new webpack.LoaderOptionsPlugin({ minimize: true }),
332324
new webpack.optimize.ModuleConcatenationPlugin(),
333325

334326
// strip out babel-helper invariant checks

packages/cli/lib/lib/webpack/webpack-client-config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ const cleanFilename = name =>
2323
''
2424
);
2525

26+
// TODO: Swap with the above when removing the async loader
27+
const cleanFilename2 = name =>
28+
(name = name.replace(/_/g, '-').replace(/(-index|-[jt]sx?$)/, ''));
29+
2630
/**
2731
* @returns {Promise<import('webpack').Configuration>}
2832
*/
@@ -88,11 +92,7 @@ async function clientConfig(env) {
8892
return env.isProd ? '[name].[chunkhash:5].js' : '[name].js';
8993
},
9094
chunkFilename: pathData => {
91-
const chunkId = /** @type {string} */ (pathData.chunk.id);
92-
const chunkName =
93-
typeof chunkId === 'string'
94-
? chunkId.split('_').slice(0, -1).join('-')
95-
: chunkId;
95+
const chunkName = cleanFilename2(pathData.chunk.id);
9696
return env.isProd
9797
? `${chunkName}.chunk.[chunkhash:5].js`
9898
: `${chunkName}.chunk.js`;

0 commit comments

Comments
 (0)