update nuxt.config.js txt loader

This commit is contained in:
x ronger 2020-10-18 18:57:17 +08:00
parent 888ab2b349
commit 095cd0c90c

View File

@ -1,6 +1,7 @@
import appConfig from './config/app.config' import appConfig from './config/app.config'
import apiConfig from './config/api.config' import apiConfig from './config/api.config'
import {isDevMode} from './environment' import {isDevMode} from './environment'
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin') const LodashModuleReplacementPlugin = require('lodash-webpack-plugin')
export default { export default {
@ -8,7 +9,7 @@ export default {
** Nuxt rendering mode ** Nuxt rendering mode
** See https://nuxtjs.org/api/configuration-mode ** See https://nuxtjs.org/api/configuration-mode
*/ */
mode: 'universal', ssr: true,
/* /*
** Render configuration ** Render configuration
*/ */
@ -96,6 +97,7 @@ export default {
extend(config, ctx) { extend(config, ctx) {
config.plugins.unshift(new LodashModuleReplacementPlugin()) config.plugins.unshift(new LodashModuleReplacementPlugin())
// rules[2].use[0] is babel-loader // rules[2].use[0] is babel-loader
config.module.rules.push({ test: /\.txt$/, use: 'raw-loader' })
config.module.rules[2].use[0].options.plugins = ['lodash'] config.module.rules[2].use[0].options.plugins = ['lodash']
} }
} }