Skip to content

Commit

Permalink
fix: set browserlist so that js files are transpiled (#1457)
Browse files Browse the repository at this point in the history
* fix: set `browserlist` so that js files are transpiled

so that modern syntax like `??` which is tripping up some build systems are transpiled

* fix: set webpack target to `web` for docs build

previously it would default to this, but with a `browserList` set it chooses that instead and fails if it's empty

* fix: set webpack target for cypress
  • Loading branch information
tjenkinson authored Jan 8, 2023
1 parent d1a7f67 commit c406ab2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
10 changes: 9 additions & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@ module.exports = defineConfig({
baseUrl: 'http://localhost:6006',
video: false,
setupNodeEvents(on) {
on('file:preprocessor', webpackPreprocessor())
on(
'file:preprocessor',
webpackPreprocessor({
webpackOptions: {
...webpackPreprocessor.defaultOptions.webpackOptions,
target: 'web',
},
}),
)
},
},
})
11 changes: 10 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,16 @@ const config = {
}),
],
],
plugins: [require.resolve('./docusaurus/plugins/webpack5polyfills.js')],
plugins: [
// @ts-ignore
() => ({
name: 'configure-webpack-target',
configureWebpack(webpackConfig, isServer) {
webpackConfig.target = isServer ? 'node' : 'web'
},
}),
require.resolve('./docusaurus/plugins/webpack5polyfills.js'),
],
}

module.exports = config
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"module": "dist/downshift.esm.js",
"typings": "typings/index.d.ts",
"sideEffects": false,
"browserslist": [],
"scripts": {
"build": "npm run build:web --silent && npm run build:native --silent",
"build:web": "kcd-scripts build --bundle --p-react --no-clean --size-snapshot",
Expand Down

0 comments on commit c406ab2

Please sign in to comment.