how i can use export default and require (webpack2)
See original GitHub issuet.js:
export default class {
}
index.js:
const cls = require("./t");
export default class PreferenceOmitDialogCondition extends cls {
}
i know that i can require(“./t”).default , but i have many old code and it difficult change.
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Module Methods - webpack
Labeled Modules. The internal LabeledModulesPlugin enables you to use the following methods for exporting and requiring within your modules: export label.
Read more >Fixing export default on Webpack when bundling a library
Required workaround to properly distribute a library built with Typescript, Babel and Webpack. As my latest project is a standalone library, ...
Read more >How do I expose a javascript module's default export object ...
You can use ProvidePlugin in order to do so. At first you need to make alias for the file you want to be...
Read more >wordpress/library-export-default-webpack-plugin | Block Editor ...
Webpack plugin for exporting default property for selected libraries which use ES6 Modules. Implementation is based on the Webpack's core plugin ...
Read more >How to transpile ES modules with webpack and Node.js
Also note that we can have default exports with ESM. ... Now, we need to compile our ES2015 code to ES5 so that...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Don’t mix babel es6 module handling with webpacks. webpack allows to mix CommonJs and ES6 modules this way:
Don’t use the add-module-exports plugin.
PS:
exports.a
is used instead ofexports.default
when a es6 module is only imported via es6 imports. webpack mangles the export names.The code is wrong. Change it.