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