Exports * not working
See original GitHub issue- Laravel Mix Version: 0.7.5
- Node Version (
node -v
): 6.8.0 - NPM Version (
npm -v
): 3.10.8 - OS: OSX El Capitan
Description:
Exporting all (*) objects from a module throws an unknown error : “exports is not defined”
This worked perfectly in our webpack only setup but I’ve been struggling to get this to work with Laravel mix since 3 days now.
Any help would be greatly appreciated.
Steps To Reproduce:
services/index.js
export * from './auth.js'
export * from './ls.js'
app.vue
import { auth } from 'services/index.js'
Issue Analytics
- State:
- Created 7 years ago
- Comments:5
Top Results From Across the Web
Module exports not working - Stack Overflow
Its happening because of circular dependency resolution. A -> B -> A To fix this, don't use require at the top of the...
Read more >How to use module.exports in Node.js - Stack Abuse
exports but this would not work with exports . // export the courses so other modules can use them module.exports = { film101:...
Read more >Node Module Exports Explained - freeCodeCamp
They assign exports to a new value, thinking that it's the same as "default exporting" through module.exports . However, this will not work...
Read more >Package.json star and directory exports not working #3417
Describe the bug. The newly introduced package.json exports field explicitly defines the exports map for a library.
Read more >Package exports - webpack
The exports field in the package.json of a package allows to declare which module ... Note: Only the first valid result will be...
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 FreeTop 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
Top GitHub Comments
I’m not sure, but, out of the box, everything seems to be working properly. So I think this issue is unrelated to what Mix ships with.
I’m assuming it’s related to your file structure, and the addition of the add-module-exports Babel plugin.
I wasn’t sure really sure if its unrelated to laravel-mix as it worked in our previous webpack only setup.
Btw
add-module-exports
was the culprit. It causes problems with named exports. So it looks like we can either use that plugin or named exports.More info below in case someone else has the same problem: http://stackoverflow.com/questions/33505992/babel-6-changes-how-it-exports-default
Thank you very much for that hint Jeff! 🥇