mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 22:25:12 +00:00
perf,fix: source map improvements
This commit is contained in:
parent
87ac7d0cb4
commit
452747b3c4
@ -18,7 +18,6 @@ const WarnFixPlugin = require('./plugins/warnfix')
|
|||||||
module.exports = function webpackBaseConfig({ name, isServer }) {
|
module.exports = function webpackBaseConfig({ name, isServer }) {
|
||||||
const config = {
|
const config = {
|
||||||
name,
|
name,
|
||||||
devtool: this.options.dev ? 'cheap-source-map' : false,
|
|
||||||
entry: {
|
entry: {
|
||||||
app: null
|
app: null
|
||||||
},
|
},
|
||||||
@ -28,8 +27,7 @@ module.exports = function webpackBaseConfig({ name, isServer }) {
|
|||||||
chunkFilename: this.getFileName('chunk'),
|
chunkFilename: this.getFileName('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))
|
||||||
devtoolModuleFilenameTemplate: '[absolute-resource-path]'
|
|
||||||
},
|
},
|
||||||
performance: {
|
performance: {
|
||||||
maxEntrypointSize: 1000000,
|
maxEntrypointSize: 1000000,
|
||||||
|
@ -33,6 +33,10 @@ module.exports = function webpackClientConfig() {
|
|||||||
config.entry.app = resolve(this.options.buildDir, 'client.js')
|
config.entry.app = resolve(this.options.buildDir, 'client.js')
|
||||||
config.entry.vendor = this.vendor()
|
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
|
// Add CommonChunks plugin
|
||||||
commonChunksPlugin.call(this, config)
|
commonChunksPlugin.call(this, config)
|
||||||
|
|
||||||
|
@ -14,16 +14,18 @@ const base = require('./base.config.js')
|
|||||||
module.exports = function webpackServerConfig() {
|
module.exports = function webpackServerConfig() {
|
||||||
let config = base.call(this, { name: 'server', isServer: true })
|
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 = {}
|
let env = {}
|
||||||
each(this.options.env, (value, key) => {
|
each(this.options.env, (value, key) => {
|
||||||
env['process.env.' + key] = (['boolean', 'number'].indexOf(typeof value) !== -1 ? value : JSON.stringify(value))
|
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, {
|
config = Object.assign(config, {
|
||||||
target: 'node',
|
target: 'node',
|
||||||
node: false,
|
node: false,
|
||||||
devtool: 'source-map',
|
|
||||||
entry: resolve(this.options.buildDir, 'server.js'),
|
entry: resolve(this.options.buildDir, 'server.js'),
|
||||||
output: Object.assign({}, config.output, {
|
output: Object.assign({}, config.output, {
|
||||||
filename: 'server-bundle.js',
|
filename: 'server-bundle.js',
|
||||||
|
@ -163,7 +163,7 @@ Options.defaults = {
|
|||||||
uglify: {},
|
uglify: {},
|
||||||
publicPath: '/_nuxt/',
|
publicPath: '/_nuxt/',
|
||||||
filenames: {
|
filenames: {
|
||||||
css: 'css/[name].[contenthash].css',
|
css: '[name].[contenthash].css',
|
||||||
manifest: 'manifest.[hash].js',
|
manifest: 'manifest.[hash].js',
|
||||||
vendor: 'vendor.[chunkhash].js',
|
vendor: 'vendor.[chunkhash].js',
|
||||||
app: 'app.[chunkhash].js',
|
app: 'app.[chunkhash].js',
|
||||||
|
Loading…
Reference in New Issue
Block a user