mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-16 02:44:51 +00:00
27 lines
730 B
TypeScript
27 lines
730 B
TypeScript
import VueLoaderPlugin from 'vue-loader/dist/pluginWebpack5'
|
|
import VueSSRClientPlugin from '../plugins/vue/client'
|
|
import VueSSRServerPlugin from '../plugins/vue/server'
|
|
import { WebpackConfigContext } from '../utils/config'
|
|
|
|
export function vue (ctx: WebpackConfigContext) {
|
|
const { options, config } = ctx
|
|
|
|
config.plugins.push(new VueLoaderPlugin())
|
|
|
|
config.module.rules.push({
|
|
test: /\.vue$/i,
|
|
loader: 'vue-loader',
|
|
options: options.build.loaders.vue
|
|
})
|
|
|
|
if (ctx.isClient) {
|
|
config.plugins.push(new VueSSRClientPlugin({
|
|
filename: `../server/${ctx.name}.manifest.json`
|
|
}))
|
|
} else {
|
|
config.plugins.push(new VueSSRServerPlugin({
|
|
filename: `${ctx.name}.manifest.json`
|
|
}))
|
|
}
|
|
}
|