Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files outside src/ aren't compiled with Babel #1699

Closed
debugpoint136 opened this issue Mar 2, 2017 · 10 comments
Closed

Files outside src/ aren't compiled with Babel #1699

debugpoint136 opened this issue Mar 2, 2017 · 10 comments
Milestone

Comments

@debugpoint136
Copy link

Problem: Using ES6 feature like template string or fat arrow function notation, in any helper JS functions to fetch data and pass it to React components, npm start works fine but npm run build fails

Error:-

static/js/main.edbb179d.js from UglifyJs
SyntaxError: Unexpected token: operator (>) [./api/consensus_view-api.js:65,0]

static/js/main.d10c594a.js from UglifyJs
SyntaxError: Unexpected character '`' [./api/consensus_view-api.js:25,0]

node - 6.10.0
npm - 3.10.10
OS - MacOS El Capitan
react-scripts: 0.9.3

@debugpoint136
Copy link
Author

Also, Went through #1194 thread. NODE_PATH is not set to anything

@Timer
Copy link
Contributor

Timer commented Mar 2, 2017

C+P:
Looks like you're trying to import a JavaScript file from outside src/; this is not supported. The file will not be compiled.

This behavior will most likely be disallowed in 0.10.

@debugpoint136
Copy link
Author

Oh wow! Thanks for catching that. I moved that folder to src and it compiles successfully!

@gaearon gaearon changed the title npm run build fails for ES6 template strings Files outside src/ aren't compiled with Babel Mar 2, 2017
@gaearon gaearon reopened this Mar 2, 2017
@gaearon
Copy link
Contributor

gaearon commented Mar 2, 2017

I will reopen so that we don't forget to completely forbid importing them somehow.

@gaearon gaearon added this to the 0.10.0 milestone Mar 2, 2017
@Timer
Copy link
Contributor

Timer commented Mar 2, 2017

We have this old issue too: #1234

@gaearon
Copy link
Contributor

gaearon commented Mar 2, 2017

Oh okay.

@nikoloza
Copy link

guys, any workaround for now?

@gaearon
Copy link
Contributor

gaearon commented Mar 28, 2017

Workaround for what exactly? Files outside src are intentionally not compiled. Future behavior will likely be forbidding imports from outside of src or node_modules.

@nikoloza
Copy link

nikoloza commented Mar 28, 2017

Thanks for quick reply @gaearon
Currently node_modules is also not reachable.
Full description here: #1107 (comment)

@gaearon
Copy link
Contributor

gaearon commented Mar 28, 2017

Replied there.

@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants