perf,fix: source map improvements

This commit is contained in:
Pooya Parsa 2018-01-05 03:04:20 +03:30
parent 87ac7d0cb4
commit 452747b3c4
4 changed files with 10 additions and 6 deletions

View File

@ -18,7 +18,6 @@ const WarnFixPlugin = require('./plugins/warnfix')
module.exports = function webpackBaseConfig({ name, isServer }) {
const config = {
name,
devtool: this.options.dev ? 'cheap-source-map' : false,
entry: {
app: null
},
@ -28,8 +27,7 @@ module.exports = function webpackBaseConfig({ name, isServer }) {
chunkFilename: this.getFileName('chunk'),
publicPath: (isUrl(this.options.build.publicPath)
? this.options.build.publicPath
: urlJoin(this.options.router.base, this.options.build.publicPath)),
devtoolModuleFilenameTemplate: '[absolute-resource-path]'
: urlJoin(this.options.router.base, this.options.build.publicPath))
},
performance: {
maxEntrypointSize: 1000000,

View File

@ -33,6 +33,10 @@ module.exports = function webpackClientConfig() {
config.entry.app = resolve(this.options.buildDir, 'client.js')
config.entry.vendor = this.vendor()
// Config devtool
config.devtool = this.options.dev ? 'cheap-source-map' : false
config.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]'
// Add CommonChunks plugin
commonChunksPlugin.call(this, config)

View File

@ -14,16 +14,18 @@ const base = require('./base.config.js')
module.exports = function webpackServerConfig() {
let config = base.call(this, { name: 'server', isServer: true })
// env object defined in nuxt.config.js
// Env object defined in nuxt.config.js
let env = {}
each(this.options.env, (value, key) => {
env['process.env.' + key] = (['boolean', 'number'].indexOf(typeof value) !== -1 ? value : JSON.stringify(value))
})
// Config devtool
config.devtool = this.options.dev ? 'cheap-source-map' : false
config = Object.assign(config, {
target: 'node',
node: false,
devtool: 'source-map',
entry: resolve(this.options.buildDir, 'server.js'),
output: Object.assign({}, config.output, {
filename: 'server-bundle.js',

View File

@ -163,7 +163,7 @@ Options.defaults = {
uglify: {},
publicPath: '/_nuxt/',
filenames: {
css: 'css/[name].[contenthash].css',
css: '[name].[contenthash].css',
manifest: 'manifest.[hash].js',
vendor: 'vendor.[chunkhash].js',
app: 'app.[chunkhash].js',