Skip to content

Commit

Permalink
Ensure govuk modules import the actual window
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldfallen committed Mar 7, 2018
1 parent 15d1f5e commit cf93247
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/sources/govukToolkit.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const govukModule = (file, expose, imports = ['window.jQuery=jquery']) => {
return {
test: path.resolve(javascripts, file),
use: [
`imports-loader?${importsArr.join(',')}`,
// All govuk modules attach to window and so need window imported
`imports-loader?${['window=window', ...importsArr].join(',')}`,
`exports-loader?${exposeArr.join(',')}`
]
};
Expand Down
1 change: 1 addition & 0 deletions src/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const webpackSettings = (assetPath, settings) => {
path: path.resolve('./dist'),
filename: '[name].js'
},
externals: [{ window: 'window' }],
module: {
rules: [
...browserSupport,
Expand Down

0 comments on commit cf93247

Please sign in to comment.