liady / webpack-node-externals

Easily exclude node modules in Webpack
MIT License
1.3k stars 62 forks source link

How To Combine w/ Existing Externals #70

Closed jrodl3r closed 4 years ago

jrodl3r commented 4 years ago

Have the following existing externals on webpack.server.config.js:

externals: {
  './dist/server/main': 'require("./server/main")'
},

Need to add this to avoid some errors:

externals: [
  nodeExternals({
      whitelist: [
        /^instantsearch.js/,
        /^angular-instantsearch/
      ]
  })
]

However, when I combine the two, either by placing this above or below nodeExternals(...) the error we're trying to avoid persists: { './dist/server/main': 'require("./server/main")' },

Please help explain how I can effectively combine these.

Really appreciate any help or suggestions - Thx!