mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 22:25:12 +00:00
Remove build.loaders
option
Also moves default postCSS logic into webpack config
This commit is contained in:
parent
2df044664a
commit
faa8db4701
@ -37,16 +37,6 @@ export default class Builder extends Tapable {
|
|||||||
this.webpackDevMiddleware = null
|
this.webpackDevMiddleware = null
|
||||||
this.webpackHotMiddleware = null
|
this.webpackHotMiddleware = null
|
||||||
|
|
||||||
// Add extra loaders only if they are not already provided
|
|
||||||
let extraDefaults = {}
|
|
||||||
if (this.options.build && !Array.isArray(this.options.build.loaders)) {
|
|
||||||
extraDefaults.loaders = defaultsLoaders
|
|
||||||
}
|
|
||||||
if (this.options.build && !Array.isArray(this.options.build.postcss)) {
|
|
||||||
extraDefaults.postcss = defaultsPostcss
|
|
||||||
}
|
|
||||||
_.defaultsDeep(this.options.build, extraDefaults)
|
|
||||||
|
|
||||||
// Mute stats on dev
|
// Mute stats on dev
|
||||||
this.webpackStats = this.options.dev ? false : {
|
this.webpackStats = this.options.dev ? false : {
|
||||||
chunks: false,
|
chunks: false,
|
||||||
@ -406,31 +396,6 @@ export default class Builder extends Tapable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultsLoaders = [
|
|
||||||
{
|
|
||||||
test: /\.(png|jpe?g|gif|svg)$/,
|
|
||||||
loader: 'url-loader',
|
|
||||||
query: {
|
|
||||||
limit: 1000, // 1KO
|
|
||||||
name: 'img/[name].[hash:7].[ext]'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
|
||||||
loader: 'url-loader',
|
|
||||||
query: {
|
|
||||||
limit: 1000, // 1 KO
|
|
||||||
name: 'fonts/[name].[hash:7].[ext]'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
const defaultsPostcss = [
|
|
||||||
require('autoprefixer')({
|
|
||||||
browsers: ['last 3 versions']
|
|
||||||
})
|
|
||||||
]
|
|
||||||
|
|
||||||
const STATUS = {
|
const STATUS = {
|
||||||
INITIAL: 1,
|
INITIAL: 1,
|
||||||
BUILD_DONE: 2,
|
BUILD_DONE: 2,
|
||||||
|
@ -17,6 +17,14 @@ import { styleLoader, extractStyles } from './helpers'
|
|||||||
export default function webpackBaseConfig ({ isClient, isServer }) {
|
export default function webpackBaseConfig ({ isClient, isServer }) {
|
||||||
const nodeModulesDir = join(__dirname, '..', 'node_modules')
|
const nodeModulesDir = join(__dirname, '..', 'node_modules')
|
||||||
|
|
||||||
|
if (!Array.isArray(this.options.build.postcss)) {
|
||||||
|
this.options.build.postcss = [
|
||||||
|
require('autoprefixer')({
|
||||||
|
browsers: ['last 3 versions']
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
devtool: this.options.dev ? 'cheap-module-source-map' : false,
|
devtool: this.options.dev ? 'cheap-module-source-map' : false,
|
||||||
entry: {
|
entry: {
|
||||||
|
Loading…
Reference in New Issue
Block a user