Skip to content

Commit

Permalink
junk: Kinda works but not really
Browse files Browse the repository at this point in the history
  • Loading branch information
rschristian committed Aug 18, 2022
1 parent e8ff2ec commit a647dc3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
14 changes: 3 additions & 11 deletions packages/cli/lib/lib/webpack/webpack-base-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,16 +292,9 @@ module.exports = function createBaseConfig(env) {
new MiniCssExtractPlugin({
filename:
isProd && !env.isServer ? '[name].[contenthash:5].css' : '[name].css',
chunkFilename: pathData => {
const chunkId = /** @type {string} */ (pathData.chunk.id);
const chunkName =
typeof chunkId === 'string'
? chunkId.split('_').slice(0, -1).join('-')
: chunkId;
return isProd
? `${chunkName}.chunk.[chunkhash:5].css`
: `${chunkName}.chunk.css`;
},
chunkFilename: isProd
? '[name].chunk.[contenthash:5].css'
: '[name].chunk.css',
}),
ProgressBarPlugin({
format:
Expand All @@ -328,7 +321,6 @@ module.exports = function createBaseConfig(env) {
},
},
}),
isProd && new webpack.LoaderOptionsPlugin({ minimize: true }),
new webpack.optimize.ModuleConcatenationPlugin(),

// strip out babel-helper invariant checks
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/lib/lib/webpack/webpack-client-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ const cleanFilename = name =>
''
);

// TODO: Swap with the above when removing the async loader
const cleanFilename2 = name =>
(name = name.replace(/_/g, '-').replace(/(-index|-[jt]sx?$)/, ''));

/**
* @returns {Promise<import('webpack').Configuration>}
*/
Expand Down Expand Up @@ -88,11 +92,7 @@ async function clientConfig(env) {
return env.isProd ? '[name].[chunkhash:5].js' : '[name].js';
},
chunkFilename: pathData => {
const chunkId = /** @type {string} */ (pathData.chunk.id);
const chunkName =
typeof chunkId === 'string'
? chunkId.split('_').slice(0, -1).join('-')
: chunkId;
const chunkName = cleanFilename2(pathData.chunk.id);
return env.isProd
? `${chunkName}.chunk.[chunkhash:5].js`
: `${chunkName}.chunk.js`;
Expand Down

0 comments on commit a647dc3

Please sign in to comment.