简体   繁体   中英

NPM: edit es6 written plugin in node_modules dir without transpiling

I've got a plugin I wrote in es6, and I'm currently testing the plugin on a site that I'm building. When there's an issue, I would like to quickly modify the plugin directly in the node_modules folder, however everytime I need to make a change, I need to rebuild the dist folder for that plugin using babel-cli.

Is there anyway to get around this? Is there a webpack solution for this?

Not sure if understand you correctly where do you execute this code, but any way if it is executed in node - node supports es, just use latest version. If it is browser - then again you have two options execute file without transcompiling it at all https://kangax.github.io/compat-table/es6/ , or use babel directly in the browser: http://babeljs.io/docs/usage/browser/

Your problem derives from the use of a transpiler to transform your source code before loading it into the browser. You can avoid this by using an isomorphic module pattern like this example , with introductory article .

Another alternative that is webpack compatible is to use the webpack hot loader.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM