mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 22:25:12 +00:00
Merge pull request #1613 from clarkdo/dev
refactor: fix some code issues
This commit is contained in:
commit
2db304e222
@ -1,15 +1,15 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
build: {
|
build: {
|
||||||
filenames: {
|
filenames: {
|
||||||
css: 'styles.[chunkhash].css', // default: common.[chunkhash].css
|
css: 'styles.[chunkhash].css', // default: common.[chunkhash].css
|
||||||
manifest: 'manifest.[hash].js', // default: manifest.[hash].js
|
manifest: 'manifest.[hash].js', // default: manifest.[hash].js
|
||||||
vendor: 'vendor.[hash].js', // default: vendor.bundle.[hash].js
|
vendor: 'vendor.[hash].js', // default: vendor.bundle.[hash].js
|
||||||
app: 'app.[chunkhash].js' // default: nuxt.bundle.[chunkhash].js
|
app: 'app.[chunkhash].js' // default: nuxt.bundle.[chunkhash].js
|
||||||
},
|
},
|
||||||
vendor: ['lodash'],
|
vendor: ['lodash'],
|
||||||
extend (config, { dev }) {
|
extend (config, { dev }) {
|
||||||
if (dev) {
|
if (dev) {
|
||||||
config.devtool = (dev ? 'eval-source-map' : false)
|
config.devtool = 'eval-source-map'
|
||||||
}
|
}
|
||||||
const urlLoader = config.module.rules.find((loader) => loader.loader === 'url-loader')
|
const urlLoader = config.module.rules.find((loader) => loader.loader === 'url-loader')
|
||||||
// Increase limit to 100KO
|
// Increase limit to 100KO
|
||||||
|
@ -7,7 +7,7 @@ module.exports = function (options) {
|
|||||||
loader: 'ts-loader'
|
loader: 'ts-loader'
|
||||||
})
|
})
|
||||||
// Add TypeScript loader for vue files
|
// Add TypeScript loader for vue files
|
||||||
for (rule of config.module.rules) {
|
for (let rule of config.module.rules) {
|
||||||
if (rule.loader === 'vue-loader') {
|
if (rule.loader === 'vue-loader') {
|
||||||
rule.query.loaders.ts = 'ts-loader?{"appendTsSuffixTo":["\\\\.vue$"]}'
|
rule.query.loaders.ts = 'ts-loader?{"appendTsSuffixTo":["\\\\.vue$"]}'
|
||||||
}
|
}
|
||||||
|
@ -486,9 +486,9 @@ export default class Builder extends Tapable {
|
|||||||
compiler.run((err, stats) => {
|
compiler.run((err, stats) => {
|
||||||
/* istanbul ignore if */
|
/* istanbul ignore if */
|
||||||
if (err) {
|
if (err) {
|
||||||
|
console.error(err) // eslint-disable-line no-console
|
||||||
return reject(err)
|
return reject(err)
|
||||||
}
|
}
|
||||||
if (err) return console.error(err) // eslint-disable-line no-console
|
|
||||||
|
|
||||||
// Show build stats for production
|
// Show build stats for production
|
||||||
console.log(stats.toString(this.webpackStats)) // eslint-disable-line no-console
|
console.log(stats.toString(this.webpackStats)) // eslint-disable-line no-console
|
||||||
|
@ -243,7 +243,7 @@ export default class Renderer extends Tapable {
|
|||||||
path: this.publicPath,
|
path: this.publicPath,
|
||||||
handler: serveStatic(distDir, {
|
handler: serveStatic(distDir, {
|
||||||
index: false, // Don't serve index.html template
|
index: false, // Don't serve index.html template
|
||||||
maxAge: (this.options.dev ? 0 : '1y') // 1 year in production
|
maxAge: '1y' // 1 year in production
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user