Skip to content

Commit

Permalink
webpack: Whitelist atlaskit and react-spinkit stuff from nodeExternals
Browse files Browse the repository at this point in the history
When building as a library, all of the externals get require'd
immediately before we have a chance to monkey-patch them, which
breaks on node, because those requirements use things that are
only defined in the browser. Instead, just bundle them, which means
that this behaviour does not occurr.
  • Loading branch information
smspillaz committed Feb 25, 2018
1 parent 2b55db6 commit 3d594f2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion internals/webpack/webpack.prod.serverless.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,19 @@ module.exports = require('./webpack.prod.babel')({
path.join(process.cwd(), 'lambda.js'),
],

externals: [nodeExternals()],
externals: [nodeExternals({
// Need to whitelist @atlaskit/dropdown-menu things here,
// otherwise when building the library it gets directly required, which in
// turn causes node to trip up because navigator is not defined.
whitelist: [
'@atlaskit/avatar',
'@atlaskit/dropdown-menu',
'@atlaskit/droplist',
'@atlaskit/navigation',
'react-spinkit',
'loaders.css',
],
})],

output: {
filename: 'prodLambda.js',
Expand Down

0 comments on commit 3d594f2

Please sign in to comment.