-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make local file extension optional #5
Conversation
Wow, that’s interesting. Mind sharing your (And thanks for the PR!) |
webpack@3.10.0 I replace some content with module.exports = merge(common, {
entry: {
core: [path.join(ARCHETYPE_ROOT, 'conf', 'webpack', 'application', '.css.js')].concat(entry),
chrome: ['chrome'],
main: [...]
},
resolve: {
alias: Object.assign({}, alias.components, alias.core)
},
output: {
filename: '[name].min.js',
path: path.join(MODULE_ROOT, target)
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.js$/,
include: (() => {
const paths = [path.resolve(MODULE_ROOT, 'src')];
return reduce(alias.components, (acc, cPath) => {
acc.push(path.dirname(cPath));
return acc;
}, paths);
})(),
use: {
loader: require.resolve('babel-loader'),
options: resolveBabelPlugins(babel)
}
}
]
},
plugins: [
new MomentLocalesPlugin({
localesToKeep: locales
}),
new CopyWebpackPlugin([{
...
}, {
...
}]),
new UglifyJSPlugin({
sourceMap: true
}),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'common',
filename: 'common.min.js',
minChunks: 2,
chunks: ['chrome', 'main']
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'core',
minChunks: Infinity,
filename: 'core.min.js'
})
]
}); |
Thanks! And what’s the exact webpack & Moment.js version? (Just to test this myself) |
webpack@3.10.0 |
Great! I’ll take a look into this in a day or two. |
Huh, this took a bit longer :D I was unable to reproduce this with const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
module.exports = {
entry: {
main: './src/index.js',
},
output: {
path: __dirname,
filename: '[name].bundle.js',
},
plugins: [
new MomentLocalesPlugin({
localesToKeep: ['ru'],
}),
],
}; I also tried adding the CommonsChunkPlugin, but that had no effect. Is this issue still reproducible for you? |
Not sure. I ended up doing a copy and paste + modifying as work around, so I have my own local copy with a reference to this issue. I am currently traveling, but I will check if it is still occurring upon return. |
Thanks! 👍 |
Merged as there’s #8 with the same issue. Thank you for the PR! |
When the
localesToKeep
option has at least one element the plugin is not filtering out any locales when running webpack 3.x.x and moment 2.9.x and code splitting using CommonsChunkPlugin. This PR makes the.js
file extension optional and fixes filtering with the above versions. This hasn't been tested using other version combinations.