question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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” 971a7e932c571ef684c928f062d5985a

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:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
JeffreyWaycommented, Feb 16, 2017

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.

0reactions
mohitpanjwanicommented, Feb 17, 2017

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! 🥇

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found