I'm writing my first module. Basically the code is exactly the same for both the browser and node.js versions. The only difference is that the browser uses XmlHttpRequest whilst node.js uses http module. I've successfully built the module with webpack with two different targets (node and web) and now I have two js (module.node.js and module.js). Everything works but I would like to write the exact same require for both node and the browser, let's say require('./dist/module'). Instead now I have require('./dist/module') for the browser and require('./dist/module.node') for node. Is there a way to achieve this with webpack?
via Massimo Necchi
No comments:
Post a Comment