es6 import syntax error
See original GitHub issueHi!
I try to use inject-loader
on a following file:
import AuthResource from './../../resources/auth/Auth';
import { REMOVE_TOKEN, SET_TOKEN } from '../actions';
export default {
// ...
};
with code
const actionsInjector = require('inject!./actions');
and an error appears
ERROR in ./~/inject-loader/dist!./resources/assets/js/store/auth/auth.js
Module parse failed: /home/megapixel23/Projects/vue-demo/node_modules/inject-loader/dist/index.js!/home/megapixel23/Projects/vue-demo/resources/assets/js/store/auth/auth.js 'import' and 'export' may only appear at the top level (26:6)
You may need an appropriate loader to handle this file type.
| (function () {
| // $FlowIgnore
| import AuthResource from './../../resources/auth/Auth';
| import { REMOVE_TOKEN, SET_TOKEN } from '../actions';
|
@ ./resources/assets/js/store/auth/auth.spec.js 2:24-58
Seems like es6 import syntax does not work in inject-loader
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Node.js - SyntaxError: Unexpected token import - Stack Overflow
Enable ES6 imports in node js provides a solution to this issue. I have tried this and it worked for me. Run the...
Read more >Why your ES6+ syntax doesn't work in Node.js and how to fix it
json file by running of the following two commands in your project directory. npm init // npm int. Packages. Node modules can be...
Read more >Unexpected token import Node.js - Reactgo
When we use es6 modules import/export statements in Node.js. It gives a following error in the terminal because node is currently not supporting...
Read more >JavaScript : ES6 module Import giving "Uncaught SyntaxError
JavaScript : ES6 module Import giving "Uncaught SyntaxError : Unexpected identifier" [ Gift : Animated Search Engine ...
Read more >can not use import statement outside a module - YouTube
JS - JavaScript. syntaxerror - can not use import statement outside a module | es6 vs commonjs modules in nodejs.
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
@plasticine Do you have any examples with Babel 7? I’m getting similar issues once upgrading to Babel 7. Worked fine with Babel 6.
@MEGApixel23 Please check out the examples in the repo — specifically the webpack config. This is not an issue with
inject-loader
, you’re just missing some config.