diff --git a/README.md b/README.md index 0387fd8f..9168fa13 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/package.json b/package.json index 1edf78ad..a695cbb9 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "exports": { ".": { "import": { - "types": "./dist/config.d.ts" + "types": "./dist/config.d.ts", + "require": "./dist/index.cjs" } } }, diff --git a/webpack.config.ts b/webpack.config.ts index 1f90d613..64b7fc49 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -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: [ { @@ -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' }, }, };