Skip to content

Commit

Permalink
Use explicit .cjs extension when importing CommonJS files
Browse files Browse the repository at this point in the history
  • Loading branch information
zewish committed Dec 9, 2023
1 parent f931416 commit 79cb906
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions .babelrc.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createRequire } from 'module'
import { createRequire } from 'module';
const require = createRequire(import.meta.url);

const browsers = [
Expand Down Expand Up @@ -29,7 +29,12 @@ export default {
presets: getPresets(),
env: {
cjs: {
presets: getPresets({ modules: 'commonjs' })
presets: getPresets({ modules: 'commonjs' }),
plugins: [
[require.resolve('babel-plugin-module-extension-resolver'), {
dstExtension: '.cjs'
}]
]
},
mjs: {
presets: getPresets({ modules: false }),
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redux-remember",
"version": "5.0.0",
"version": "5.0.1",
"description": "Saves and loads your redux state from a key-value store of your choice",
"author": "Iskren Slavov <[email protected]>",
"license": "MIT",
Expand Down

0 comments on commit 79cb906

Please sign in to comment.