mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-06 21:10:38 +00:00
fix: move extractText to base.config
fixes test/fixtures/ssr.
This commit is contained in:
parent
3eea48899b
commit
03f3ff4517
@ -1,5 +1,6 @@
|
||||
import path from 'path'
|
||||
|
||||
import ExtractTextPlugin from 'extract-text-webpack-plugin'
|
||||
import FriendlyErrorsWebpackPlugin from '@nuxtjs/friendly-errors-webpack-plugin'
|
||||
import TimeFixPlugin from 'time-fix-plugin'
|
||||
import webpack from 'webpack'
|
||||
@ -156,6 +157,22 @@ export default function webpackBaseConfig({ name, isServer }) {
|
||||
new FriendlyErrorsWebpackPlugin({ clearConsole: shouldClearConsole })
|
||||
)
|
||||
|
||||
// CSS extraction
|
||||
const extractCSS = this.options.build.extractCSS
|
||||
// TODO: Temporary disabled in dev mode for fixing source maps
|
||||
// (We need `source-map` devtool for *.css modules)
|
||||
if (extractCSS && !this.options.dev) {
|
||||
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
|
||||
return _.cloneDeep(config)
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ import path from 'path'
|
||||
import _ from 'lodash'
|
||||
import webpack from 'webpack'
|
||||
|
||||
import ExtractTextPlugin from 'extract-text-webpack-plugin'
|
||||
import HTMLPlugin from 'html-webpack-plugin'
|
||||
import StylishPlugin from 'webpack-stylish'
|
||||
import BundleAnalyzer from 'webpack-bundle-analyzer'
|
||||
@ -122,22 +121,6 @@ export default function webpackClientConfig() {
|
||||
// Create additional runtime chunk for cache boosting
|
||||
config.optimization.runtimeChunk = true
|
||||
|
||||
// CSS extraction
|
||||
const extractCSS = this.options.build.extractCSS
|
||||
// TODO: Temporary disabled in dev mode for fixing source maps
|
||||
// (We need `source-map` devtool for *.css modules)
|
||||
if (extractCSS && !this.options.dev) {
|
||||
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
|
||||
// --------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user