mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 22:25:12 +00:00
fix(webpack): revert back ExtractTextPlugin to base.config
This commit is contained in:
parent
e59152c550
commit
e6f84d16bb
@ -1,5 +1,6 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
|
import ExtractTextPlugin from 'extract-text-webpack-plugin'
|
||||||
import TimeFixPlugin from 'time-fix-plugin'
|
import TimeFixPlugin from 'time-fix-plugin'
|
||||||
import webpack from 'webpack'
|
import webpack from 'webpack'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
@ -146,6 +147,20 @@ export default function webpackBaseConfig({ name, isServer }) {
|
|||||||
// Hide warnings about plugins without a default export (#1179)
|
// Hide warnings about plugins without a default export (#1179)
|
||||||
config.plugins.push(new WarnFixPlugin())
|
config.plugins.push(new WarnFixPlugin())
|
||||||
|
|
||||||
|
// CSS extraction
|
||||||
|
const extractCSS = this.options.build.extractCSS
|
||||||
|
if (extractCSS) {
|
||||||
|
config.plugins.push(new ExtractTextPlugin(Object.assign({
|
||||||
|
filename: this.getFileName('css')
|
||||||
|
|
||||||
|
// When using optimization.splitChunks and there are
|
||||||
|
// extracted chunks in the commons chunk,
|
||||||
|
// allChunks *must* be set to true
|
||||||
|
// TODO: For nuxt this makes duplicate css assets!
|
||||||
|
// allChunks: true
|
||||||
|
}, typeof extractCSS === 'object' ? extractCSS : {})))
|
||||||
|
}
|
||||||
|
|
||||||
// Clone deep avoid leaking config between Client and Server
|
// Clone deep avoid leaking config between Client and Server
|
||||||
return _.cloneDeep(config)
|
return _.cloneDeep(config)
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import _ from 'lodash'
|
|||||||
import webpack from 'webpack'
|
import webpack from 'webpack'
|
||||||
import HTMLPlugin from 'html-webpack-plugin'
|
import HTMLPlugin from 'html-webpack-plugin'
|
||||||
import FriendlyErrorsWebpackPlugin from '@nuxtjs/friendly-errors-webpack-plugin'
|
import FriendlyErrorsWebpackPlugin from '@nuxtjs/friendly-errors-webpack-plugin'
|
||||||
import ExtractTextPlugin from 'extract-text-webpack-plugin'
|
|
||||||
import StylishPlugin from 'webpack-stylish'
|
import StylishPlugin from 'webpack-stylish'
|
||||||
import BundleAnalyzer from 'webpack-bundle-analyzer'
|
import BundleAnalyzer from 'webpack-bundle-analyzer'
|
||||||
|
|
||||||
@ -135,22 +134,6 @@ export default function webpackClientConfig() {
|
|||||||
// Create additional runtime chunk for cache boosting
|
// Create additional runtime chunk for cache boosting
|
||||||
config.optimization.runtimeChunk = true
|
config.optimization.runtimeChunk = true
|
||||||
|
|
||||||
// CSS extraction
|
|
||||||
const extractCSS = this.options.build.extractCSS
|
|
||||||
if (extractCSS) {
|
|
||||||
config.plugins.push(new ExtractTextPlugin(Object.assign({
|
|
||||||
filename: this.getFileName('css')
|
|
||||||
|
|
||||||
// When using optimization.splitChunks and there are
|
|
||||||
// extracted chunks in the commons chunk,
|
|
||||||
// allChunks *must* be set to true
|
|
||||||
// TODO: For nuxt this makes duplicate css assets!
|
|
||||||
// allChunks: true
|
|
||||||
},
|
|
||||||
typeof extractCSS === 'object' ? extractCSS : {}
|
|
||||||
)))
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------
|
// --------------------------------------
|
||||||
// Dev specific config
|
// Dev specific config
|
||||||
// --------------------------------------
|
// --------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user