Skip to content

Commit 9259f10

Browse files
fix(module): switch to commonjs2 libraryTarget (#379)
Emit `__esModule` indicators for ES modules to distinguish between them and CommonJS modules. If libraryTarget is set to `commonjs`, the bundle does not match the interface provided by the type declarations because `default` imports end up as `module.exports`, e.g.: ``` import transformer from 'ts-auto-mock/transformer'; // commonjs -> { default: [Function (anonymous)] } import transformer from 'ts-auto-mock/transformer'; // commonjs2 -> [Function (anonymous)] ✓ ``` Co-authored-by: Vittorio Guerriero <[email protected]>
1 parent a41ff55 commit 9259f10

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

config/modules/base/webpack.base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = (options) => {
2626
]
2727
},
2828
output: {
29-
libraryTarget: "commonjs",
29+
libraryTarget: "commonjs2",
3030
filename: "[name].js"
3131
},
3232
plugins: [

0 commit comments

Comments
 (0)