Closed windmaomao closed 5 years ago
I wish I don't need to do the following,
import Anchor from '../assets/markdown-it-anchor'
Right now, I can't load directly from node_modules
, because all ES6 stuff won't get translated inside webpack.
So, either I do babel on your repo, or I do custom import like the above.
This is a known limitation. Nowadays JS grounds are really unstable. In many of my own projects translating node_modules
is required anyway because too many packages are using ES6 features. Some developers just stick with ES2015 and never use ES6, others suggests transpiling before publishing. Even in FB it's an open issue. It's probably better to stick with ES2015 because the codebase will be really backwards compatible, but it's a lot of work to convert, test, cover and deploy this project and related ones. Also, it's like going against the flow and losing lots of improments like async module loading, named imports and other stuff built with that system in mind.
Branch 2019-stack should fix this.
I followed this, https://babeljs.io/docs/setup/#installation, and then include
seems solved
const
issue when including into project which do not have babel onnode_modules
folder.