Coder Social home page Coder Social logo

Comments (23)

nchanged avatar nchanged commented on May 14, 2024

Okay, are you sure that App has default exports? Cuz if it does not, you will get this error

Even my vscode complains on the syntax above.
try

export { App } from './App';

from fuse-box.

msuntharesan avatar msuntharesan commented on May 14, 2024

Yes it does. see fork

from fuse-box.

nchanged avatar nchanged commented on May 14, 2024

It says Declaration or statement expected

from fuse-box.

msuntharesan avatar msuntharesan commented on May 14, 2024

Sorry about that. Fixed the import. Still same error

from fuse-box.

nchanged avatar nchanged commented on May 14, 2024

If acorn complains that means that you have a syntax error

from fuse-box.

devmondo avatar devmondo commented on May 14, 2024

@VanthiyaThevan is it possible that you are using some feature that needs some babel plugin, or you are just using the original repo code?

from fuse-box.

eisisig avatar eisisig commented on May 14, 2024

I'm actually getting this error (Unexpected token) and error reporting from acorn really doesn't help.

from fuse-box.

devmondo avatar devmondo commented on May 14, 2024

@VanthiyaThevan i checked the project,

first there is syntax error here react example
cons should be const
also
export App from './App';
should be
export { App } from './App';

after i fixed those, build is passing fine, hope this helps

from fuse-box.

nchanged avatar nchanged commented on May 14, 2024

Also please, make sure you references make sense
https://github.com/vanthiyathevan/react-example/blob/master/src/App/index.js#L1
You don't have App.js file in that folder.

from fuse-box.

msuntharesan avatar msuntharesan commented on May 14, 2024

the difference to this working vs the the error
this throws error

export App from './App'

This compiles as expected.

import App from './App'
export { App };

@devmondo It is possible. I've switched to using presets latest, stage-0, and react and explicitly added transform-export-extensions. Still same acorn error.

from fuse-box.

devmondo avatar devmondo commented on May 14, 2024

@VanthiyaThevan thanks for update,

can you try this export {App} from './App' directly without import statement.

from fuse-box.

msuntharesan avatar msuntharesan commented on May 14, 2024

@devmondo
Hmm interesting. export {App} from './App' works. But given the ./App is default export, Shouldn't export App from './App' be working?

from fuse-box.

nchanged avatar nchanged commented on May 14, 2024

export App from './App' is not a valid syntax.
Please. read up here

from fuse-box.

msuntharesan avatar msuntharesan commented on May 14, 2024

I see now. the syntax I am using are part of proposal

and stage 1 supported by babel and not by acorn.
see the astexplorer.net

from fuse-box.

nchanged avatar nchanged commented on May 14, 2024

I see. I think we can use babel AST as an alternative.
Required:

  • A way to bypass acorn parse and use AST provided by other sources. (for example by babel-plugin)

from fuse-box.

nchanged avatar nchanged commented on May 14, 2024

1.3.13 has it fixed. stage-0 does not spit an error, however, is not giving me expected code back.
It transpiles it as "undefined". So it must be related to that plugin. Nonetheless, all questions to babel.

from fuse-box.

msuntharesan avatar msuntharesan commented on May 14, 2024

Thanks for the quick response. But if I specify my own test without limit2project this reverts to using only acron AST only because of This

from fuse-box.

nchanged avatar nchanged commented on May 14, 2024

Sorry, my bad. FIxed in v1.3.15

from fuse-box.

devmondo avatar devmondo commented on May 14, 2024

i can confirm that Error reporting in v1.3.16 is awesome now!!!

from fuse-box.

nchanged avatar nchanged commented on May 14, 2024

Nice! @devmondo Thanks,
Let's wait for @VanthiyaThevan to confirm that BabelPlugin is now using babel AST instead of acorn.

from fuse-box.

msuntharesan avatar msuntharesan commented on May 14, 2024

Thanks. This works. Yes the error message is very cool. Will try it on a real project and let you know.
The undefined is because of babel transpiling.
Although when export is pointing to a non existing file, The transpiling goes through without errors. May be it should warn the file doesn't exist?

from fuse-box.

nchanged avatar nchanged commented on May 14, 2024

Hi!
Thanks!
Certainly a warning can be optional. But in essence, a user might require a file that's not in a bundle. And get it via dynamic imports. So this has to be though through.

Thanks again for submitting this issue, it led to an amazing improvement on BabelPlugin and the core itself.

Cheers.

from fuse-box.

msuntharesan avatar msuntharesan commented on May 14, 2024

Thanks. I'm going to try this on a fairly large project.

from fuse-box.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.