Cannot use ES6 imports in md-seed run command
See original GitHub issueI have babel packages installed in project and ES6 imports are working well, but they are not working in mongoose-data-seed.
Here are my Babel dependencies:
"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/node": "^7.5.5",
"@babel/preset-env": "^7.5.5",
I’m submitting a…
- Regression (a behavior that used to work and stopped working in a new release)
- Bug report
- Feature request
- Documentation issue or request
- Support request
Expected Behavior
Run seeders.
Current Behavior
Throwing exception when running $ md-seed run
/home/test-app/md-seed-config.js:1
(function (exports, require, module, __filename, __dirname) { import mongoose from 'mongoose';
^^^^^^^^
SyntaxError: Unexpected identifier
Environment
- mongoose-data-seed version: 2.1.3
- Node version: v11.6.0
- Yarn version: 1.17.3
- Operating system: Linux
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How can I use an ES6 import in Node.js? - Stack Overflow
With esm you will be able to use export/import in your JavaScript files. Run the following command on your terminal yarn add esm....
Read more >How to use an ES6 import in Node.js? - GeeksforGeeks
Create a file index.js and write the program using ES6 import. ... Now run the index.js file by typing node –experimental-modules index.js ...
Read more >How to use ES6 import syntax in Node.js - DEV Community
An ES6 import syntax allows importing modules exported from a ... Run the Node.js server either by using npm start or npm run...
Read more >Mongoose-seed, Seeding MongoDB database the right way, Seed ...
Start the Docker container with the run command using the mongo image. The /data/db directory in the container is mounted as /mongodata on...
Read more >Module Methods - webpack
No CommonJS allowed, for example, you can't use require , module.exports or ... webpack supports ES6 module syntax natively, meaning you can use...
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 Free
Top 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

Solved by adding
.babelrcfile with content:I’ve noticed that you’ve added comment to already solved issue and I continued to reply to you here, but mention issue #45. Moved comments with solution to appropriate issue.