Skip to content

Commit

Permalink
fix: 🐞 bundle to CJS in webpack as for commitizen requirements
Browse files Browse the repository at this point in the history
bundle to CJS in webpack as for commitizen requirements
  • Loading branch information
tal-rofe committed Apr 15, 2023
1 parent a2aa869 commit cdf719b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ Add this to your `package.json`:
$ git cz
```
## ESM support
cz-vinyl now supports **only** ESM modules, from version `>1.6.2`. For any issue regarding this, please visit this link https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
## Configuration
Like commitizen, you can specify the configuration of cz-vinyl through various options.
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"exports": {
".": {
"import": {
"types": "./dist/config.d.ts"
"types": "./dist/config.d.ts",
"require": "./dist/index.cjs"
}
}
},
Expand Down
7 changes: 2 additions & 5 deletions webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ const configuration: webpack.Configuration = {
externals: [
nodeExternals({
modulesDir: path.join(__dirname, 'node_modules'),
importType: (moduleName) => `import ${moduleName}`,
}),
],
experiments: { outputModule: true },
module: {
rules: [
{
Expand Down Expand Up @@ -64,10 +62,9 @@ const configuration: webpack.Configuration = {
],
},
output: {
filename: 'index.js',
filename: 'index.cjs',
path: path.resolve(__dirname, 'dist'),
library: { type: 'module' },
chunkFormat: 'module',
library: { type: 'commonjs2' },
},
};

Expand Down

0 comments on commit cdf719b

Please sign in to comment.