Skip to content

Commit

Permalink
Fix server-side import without breaking window.React
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrotherham committed Jan 16, 2024
1 parent a15e29e commit 1746717
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dist/lib/accessible-autocomplete.preact.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/lib/accessible-autocomplete.preact.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/lib/accessible-autocomplete.react.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/lib/accessible-autocomplete.react.min.js.map

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions webpack.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ const bundlePreact = {

// Support `window.preact` when not bundled
// e.g. with all dependencies included via unpkg.com
globalObject: 'window'
globalObject: 'this'
},

plugins: plugins
Expand Down Expand Up @@ -197,15 +197,20 @@ const bundleReact = {
},

externals: {
preact: 'React'
preact: {
amd: 'react',
commonjs: 'react',
commonjs2: 'react',
root: 'React'
}
},

output: {
...config.output,

// Support extending `window.React` when not bundled
// e.g. with all dependencies included via unpkg.com
globalObject: 'window'
globalObject: 'this'
},

plugins: plugins
Expand Down

0 comments on commit 1746717

Please sign in to comment.