mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
parent
0acfc78932
commit
846cfee170
@ -7,6 +7,11 @@ import VueSSRServerPlugin from '../plugins/vue/server'
|
||||
|
||||
import WebpackBaseConfig from './base'
|
||||
|
||||
const nativeFileExtensions = [
|
||||
'.json',
|
||||
'.js'
|
||||
]
|
||||
|
||||
export default class WebpackServerConfig extends WebpackBaseConfig {
|
||||
constructor (...args) {
|
||||
super(...args)
|
||||
@ -20,11 +25,23 @@ export default class WebpackServerConfig extends WebpackBaseConfig {
|
||||
|
||||
get externalsWhitelist () {
|
||||
return [
|
||||
/\.(?!js(x|on)?$)/i,
|
||||
this.isNonNativeImport.bind(this),
|
||||
...this.normalizeTranspile()
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* files *not* ending on js|json should be processed by webpack
|
||||
*
|
||||
* this might generate false-positives for imports like
|
||||
* - "someFile.umd" (actually requiring someFile.umd.js)
|
||||
* - "some.folder" (some.folder being a directory containing a package.json)
|
||||
*/
|
||||
isNonNativeImport (modulePath) {
|
||||
const extname = path.extname(modulePath)
|
||||
return extname !== '' && !nativeFileExtensions.includes(extname)
|
||||
}
|
||||
|
||||
env () {
|
||||
return Object.assign(
|
||||
super.env(),
|
||||
|
Loading…
Reference in New Issue
Block a user