mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +00:00
Fix server build with CSS modules
This commit is contained in:
parent
f8de9dbe0d
commit
bfafcb9c1a
@ -55,7 +55,7 @@ const defaultsLoaders = [
|
||||
loader: 'url-loader',
|
||||
query: {
|
||||
limit: 1000, // 1KO
|
||||
name: 'img/[name].[ext]?[hash]'
|
||||
name: 'img/[name].[hash:7].[ext]'
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ const { urlJoin } = require('../../utils')
|
||||
| webpack config files
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
module.exports = function () {
|
||||
module.exports = function ({ isClient, isServer }) {
|
||||
const nodeModulesDir = join(__dirname, '..', 'node_modules')
|
||||
let config = {
|
||||
devtool: 'source-map',
|
||||
@ -57,7 +57,7 @@ module.exports = function () {
|
||||
{
|
||||
test: /\.vue$/,
|
||||
loader: 'vue-loader',
|
||||
query: vueLoaderConfig.call(this)
|
||||
query: vueLoaderConfig.call(this, { isClient, isServer })
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
|
@ -17,7 +17,7 @@ const { resolve } = require('path')
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
module.exports = function () {
|
||||
let config = base.call(this)
|
||||
let config = base.call(this, { isClient: true })
|
||||
|
||||
// Entry
|
||||
config.entry.app = resolve(this.dir, '.nuxt', 'client.js')
|
||||
|
@ -13,7 +13,7 @@ const { resolve } = require('path')
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
module.exports = function () {
|
||||
let config = base.call(this)
|
||||
let config = base.call(this, { isServer: true })
|
||||
|
||||
// env object defined in nuxt.config.js
|
||||
let env = {}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
const { defaults } = require('lodash')
|
||||
|
||||
module.exports = function () {
|
||||
module.exports = function ({ isClient }) {
|
||||
let babelOptions = JSON.stringify(defaults(this.options.build.babel, {
|
||||
plugins: [
|
||||
'transform-async-to-generator',
|
||||
@ -26,7 +26,7 @@ module.exports = function () {
|
||||
preserveWhitespace: false
|
||||
}
|
||||
|
||||
if (!this.dev) {
|
||||
if (!this.dev && isClient) {
|
||||
// Use ExtractTextPlugin to extract CSS into a single file
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||
config.loaders.css = ExtractTextPlugin.extract({ loader: 'css-loader' })
|
||||
|
Loading…
Reference in New Issue
Block a user