mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +00:00
fix(webpack): provide global URL
and URLSearchParams
(#6864)
This commit is contained in:
parent
2707bdb37e
commit
00d95903c6
@ -17,6 +17,7 @@ export default () => ({
|
||||
cache: false,
|
||||
standalone: false,
|
||||
publicPath: '/_nuxt/',
|
||||
serverURLPolyfill: 'url',
|
||||
filenames: {
|
||||
// { isDev, isClient, isServer }
|
||||
app: ({ isDev, isModern }) => isDev ? `${isModern ? 'modern-' : ''}[name].js` : '[contenthash].js',
|
||||
|
@ -130,6 +130,7 @@ Object {
|
||||
"profile": false,
|
||||
"publicPath": "/_nuxt/",
|
||||
"quiet": true,
|
||||
"serverURLPolyfill": "url",
|
||||
"splitChunks": Object {
|
||||
"commons": true,
|
||||
"layouts": false,
|
||||
|
@ -104,6 +104,7 @@ Object {
|
||||
"profile": false,
|
||||
"publicPath": "/_nuxt/",
|
||||
"quiet": true,
|
||||
"serverURLPolyfill": "url",
|
||||
"splitChunks": Object {
|
||||
"commons": true,
|
||||
"layouts": false,
|
||||
@ -458,6 +459,7 @@ Object {
|
||||
"profile": false,
|
||||
"publicPath": "/_nuxt/",
|
||||
"quiet": true,
|
||||
"serverURLPolyfill": "url",
|
||||
"splitChunks": Object {
|
||||
"commons": true,
|
||||
"layouts": false,
|
||||
|
@ -1,6 +1,6 @@
|
||||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
import webpack from 'webpack'
|
||||
import { DefinePlugin, ProvidePlugin } from 'webpack'
|
||||
import nodeExternals from 'webpack-node-externals'
|
||||
|
||||
import VueSSRServerPlugin from '../plugins/vue/server'
|
||||
@ -69,11 +69,19 @@ export default class WebpackServerConfig extends WebpackBaseConfig {
|
||||
plugins () {
|
||||
const plugins = super.plugins()
|
||||
plugins.push(
|
||||
new VueSSRServerPlugin({
|
||||
filename: `${this.name}.manifest.json`
|
||||
}),
|
||||
new webpack.DefinePlugin(this.env())
|
||||
new VueSSRServerPlugin({ filename: `${this.name}.manifest.json` }),
|
||||
new DefinePlugin(this.env())
|
||||
)
|
||||
|
||||
const { serverURLPolyfill } = this.buildContext.options.build
|
||||
|
||||
if (serverURLPolyfill) {
|
||||
plugins.push(new ProvidePlugin({
|
||||
URL: [serverURLPolyfill, 'URL'],
|
||||
URLSearchParams: [serverURLPolyfill, 'URLSearchParams']
|
||||
}))
|
||||
}
|
||||
|
||||
return plugins
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user