feat(nuxt.config.js): support chunkFileName in config

This commit is contained in:
Clark Du 2017-08-01 23:45:02 +08:00 committed by Pooya Parsa
parent 8682aa2d01
commit f22c16a7a4
3 changed files with 4 additions and 1 deletions

View File

@ -35,6 +35,7 @@ export default function webpackBaseConfig ({ isClient, isServer }) {
output: { output: {
path: resolve(this.options.buildDir, 'dist'), path: resolve(this.options.buildDir, 'dist'),
filename: this.options.build.filenames.app, filename: this.options.build.filenames.app,
chunkFilename: this.options.build.filenames.chunk,
publicPath: (isUrl(this.options.build.publicPath) publicPath: (isUrl(this.options.build.publicPath)
? this.options.build.publicPath ? this.options.build.publicPath
: urlJoin(this.options.router.base, this.options.build.publicPath)) : urlJoin(this.options.router.base, this.options.build.publicPath))

View File

@ -122,6 +122,7 @@ export default function webpackClientConfig () {
// Add HMR support // Add HMR support
config.entry.app = ['webpack-hot-middleware/client?name=$client&reload=true', config.entry.app] config.entry.app = ['webpack-hot-middleware/client?name=$client&reload=true', config.entry.app]
config.output.filename = '[name].js' config.output.filename = '[name].js'
config.output.chunkFilename = '[id].js'
config.plugins.push( config.plugins.push(
new webpack.HotModuleReplacementPlugin(), new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin() new webpack.NoEmitOnErrorsPlugin()

View File

@ -104,7 +104,8 @@ Options.defaults = {
css: 'common.[chunkhash].css', css: 'common.[chunkhash].css',
manifest: 'manifest.[hash].js', manifest: 'manifest.[hash].js',
vendor: 'vendor.bundle.[chunkhash].js', vendor: 'vendor.bundle.[chunkhash].js',
app: 'nuxt.bundle.[chunkhash].js' app: 'nuxt.bundle.[chunkhash].js',
chunk: '[id].nuxt.bundle.[chunkhash].js'
}, },
vendor: [], vendor: [],
plugins: [], plugins: [],