Why use Webpack to bundle applications that run in node environment2019 Community Moderator ElectionHow to include a few node_modules package in babel-nodeHow to bundle node modules with native addons using webpack in node-webkit?NPM vs. Bower vs. Browserify vs. Gulp vs. Grunt vs. WebpackRunning a node express server using webpack-dev-serverNode Webpack not recognizing “Import”Error using ES7 async/await with node, webpack and babel-loaderWebpack bundle increased in size after converting to ES2015/ES6 modulesModule not found in webpack bundle, but it IS in the bundleWhy do we use ES6 modules for import in frontend frameworks instead of CommonJSNode - Fails to run Webpack bundlesCan't get babel-loader to add polyfill for String.prototype.trimLeft() (aka trimStart)

What has been your most complicated TikZ drawing?

Can infringement of a trademark be pursued for using a company's name in a sentence?

Why don't MCU characters ever seem to have language issues?

validation vs test vs training accuracy, which one to compare for claiming overfit?

My story is written in English, but is set in my home country. What language should I use for the dialogue?

Straight line with arrows and dots

Does Linux have system calls to access all the features of the file systems it supports?

Should we release the security issues we found in our product as CVE or we can just update those on weekly release notes?

How do anti-virus programs start at Windows boot?

Good allowance savings plan?

Does splitting a potentially monolithic application into several smaller ones help prevent bugs?

The three point beverage

Gravity alteration as extermination tool viable?

Heap & Stack Java

Best approach to update all entries in a list that is paginated?

Is it illegal in Germany to take sick leave if you caused your own illness with food?

Running a subshell from the middle of the current command

Why doesn't the EU now just force the UK to choose between referendum and no-deal?

Want to switch to tankless, but can I use my existing wiring?

Who is our nearest neighbor

Is "history" a male-biased word ("his+story")?

Why would a jet engine that runs at temps excess of 2000°C burn when it crashes?

Fourth person (in Slavey language)

Rejected in 4th interview round citing insufficient years of experience



Why use Webpack to bundle applications that run in node environment



2019 Community Moderator ElectionHow to include a few node_modules package in babel-nodeHow to bundle node modules with native addons using webpack in node-webkit?NPM vs. Bower vs. Browserify vs. Gulp vs. Grunt vs. WebpackRunning a node express server using webpack-dev-serverNode Webpack not recognizing “Import”Error using ES7 async/await with node, webpack and babel-loaderWebpack bundle increased in size after converting to ES2015/ES6 modulesModule not found in webpack bundle, but it IS in the bundleWhy do we use ES6 modules for import in frontend frameworks instead of CommonJSNode - Fails to run Webpack bundlesCan't get babel-loader to add polyfill for String.prototype.trimLeft() (aka trimStart)










2















For me, Webpack is a bundler for "web" since browsers don't have good support for js module system. Thus using Webpack we could still use "module" way to develop and pack them for browsers.



Webpack has a config option target



module.exports = 
target: 'node'
;



using node webpack will compile for usage in a Node.js-like environment




But NodeJS already support CommonJS modules, why need Webpack to build something that runs in NodeJS environment?



Besides, if you want to compile your javascript, for example, using the ES module, you could just use babel to do so, using es module transform plugins or proper presets.



Why use Webpack, set the target to node and then use babel loader... instead of using babel directly?



I cannot think of the use case of using Webpack to bundle application running in node.










share|improve this question






















  • Webpack is sure a bundler but has support for many different use cases like parsing files, hashing parts and so on through plugins which is useful and readable.

    – binariedMe
    Mar 7 at 9:49











  • A good example is universal app that already uses Webpack to run in browser and uses its specific features (aliases, loaders, etc). In order to run it in Node it needs to be bundled with Webpack, too.

    – estus
    Mar 7 at 10:45















2















For me, Webpack is a bundler for "web" since browsers don't have good support for js module system. Thus using Webpack we could still use "module" way to develop and pack them for browsers.



Webpack has a config option target



module.exports = 
target: 'node'
;



using node webpack will compile for usage in a Node.js-like environment




But NodeJS already support CommonJS modules, why need Webpack to build something that runs in NodeJS environment?



Besides, if you want to compile your javascript, for example, using the ES module, you could just use babel to do so, using es module transform plugins or proper presets.



Why use Webpack, set the target to node and then use babel loader... instead of using babel directly?



I cannot think of the use case of using Webpack to bundle application running in node.










share|improve this question






















  • Webpack is sure a bundler but has support for many different use cases like parsing files, hashing parts and so on through plugins which is useful and readable.

    – binariedMe
    Mar 7 at 9:49











  • A good example is universal app that already uses Webpack to run in browser and uses its specific features (aliases, loaders, etc). In order to run it in Node it needs to be bundled with Webpack, too.

    – estus
    Mar 7 at 10:45













2












2








2








For me, Webpack is a bundler for "web" since browsers don't have good support for js module system. Thus using Webpack we could still use "module" way to develop and pack them for browsers.



Webpack has a config option target



module.exports = 
target: 'node'
;



using node webpack will compile for usage in a Node.js-like environment




But NodeJS already support CommonJS modules, why need Webpack to build something that runs in NodeJS environment?



Besides, if you want to compile your javascript, for example, using the ES module, you could just use babel to do so, using es module transform plugins or proper presets.



Why use Webpack, set the target to node and then use babel loader... instead of using babel directly?



I cannot think of the use case of using Webpack to bundle application running in node.










share|improve this question














For me, Webpack is a bundler for "web" since browsers don't have good support for js module system. Thus using Webpack we could still use "module" way to develop and pack them for browsers.



Webpack has a config option target



module.exports = 
target: 'node'
;



using node webpack will compile for usage in a Node.js-like environment




But NodeJS already support CommonJS modules, why need Webpack to build something that runs in NodeJS environment?



Besides, if you want to compile your javascript, for example, using the ES module, you could just use babel to do so, using es module transform plugins or proper presets.



Why use Webpack, set the target to node and then use babel loader... instead of using babel directly?



I cannot think of the use case of using Webpack to bundle application running in node.







javascript node.js webpack babel






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 7 at 9:46









Timothy LeeTimothy Lee

469212




469212












  • Webpack is sure a bundler but has support for many different use cases like parsing files, hashing parts and so on through plugins which is useful and readable.

    – binariedMe
    Mar 7 at 9:49











  • A good example is universal app that already uses Webpack to run in browser and uses its specific features (aliases, loaders, etc). In order to run it in Node it needs to be bundled with Webpack, too.

    – estus
    Mar 7 at 10:45

















  • Webpack is sure a bundler but has support for many different use cases like parsing files, hashing parts and so on through plugins which is useful and readable.

    – binariedMe
    Mar 7 at 9:49











  • A good example is universal app that already uses Webpack to run in browser and uses its specific features (aliases, loaders, etc). In order to run it in Node it needs to be bundled with Webpack, too.

    – estus
    Mar 7 at 10:45
















Webpack is sure a bundler but has support for many different use cases like parsing files, hashing parts and so on through plugins which is useful and readable.

– binariedMe
Mar 7 at 9:49





Webpack is sure a bundler but has support for many different use cases like parsing files, hashing parts and so on through plugins which is useful and readable.

– binariedMe
Mar 7 at 9:49













A good example is universal app that already uses Webpack to run in browser and uses its specific features (aliases, loaders, etc). In order to run it in Node it needs to be bundled with Webpack, too.

– estus
Mar 7 at 10:45





A good example is universal app that already uses Webpack to run in browser and uses its specific features (aliases, loaders, etc). In order to run it in Node it needs to be bundled with Webpack, too.

– estus
Mar 7 at 10:45












1 Answer
1






active

oldest

votes


















1














One reason I can think of when to use webpack for node is when you have a node_modules package where it's not compiled yet (Still in ES6).



babel-node won't be able to help you bundle the node_modules packages that need to be transpiled along with the rest of your code



I had to go through this process.. ): This scenario is helpful in Yarn Workspaces where you want your server to depend on another package in your workspace. Where your server will re-update whenever you make changes in the other package with the help of webpack



How to include a few node_modules package in babel-node






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55040635%2fwhy-use-webpack-to-bundle-applications-that-run-in-node-environment%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    One reason I can think of when to use webpack for node is when you have a node_modules package where it's not compiled yet (Still in ES6).



    babel-node won't be able to help you bundle the node_modules packages that need to be transpiled along with the rest of your code



    I had to go through this process.. ): This scenario is helpful in Yarn Workspaces where you want your server to depend on another package in your workspace. Where your server will re-update whenever you make changes in the other package with the help of webpack



    How to include a few node_modules package in babel-node






    share|improve this answer



























      1














      One reason I can think of when to use webpack for node is when you have a node_modules package where it's not compiled yet (Still in ES6).



      babel-node won't be able to help you bundle the node_modules packages that need to be transpiled along with the rest of your code



      I had to go through this process.. ): This scenario is helpful in Yarn Workspaces where you want your server to depend on another package in your workspace. Where your server will re-update whenever you make changes in the other package with the help of webpack



      How to include a few node_modules package in babel-node






      share|improve this answer

























        1












        1








        1







        One reason I can think of when to use webpack for node is when you have a node_modules package where it's not compiled yet (Still in ES6).



        babel-node won't be able to help you bundle the node_modules packages that need to be transpiled along with the rest of your code



        I had to go through this process.. ): This scenario is helpful in Yarn Workspaces where you want your server to depend on another package in your workspace. Where your server will re-update whenever you make changes in the other package with the help of webpack



        How to include a few node_modules package in babel-node






        share|improve this answer













        One reason I can think of when to use webpack for node is when you have a node_modules package where it's not compiled yet (Still in ES6).



        babel-node won't be able to help you bundle the node_modules packages that need to be transpiled along with the rest of your code



        I had to go through this process.. ): This scenario is helpful in Yarn Workspaces where you want your server to depend on another package in your workspace. Where your server will re-update whenever you make changes in the other package with the help of webpack



        How to include a few node_modules package in babel-node







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 7 at 9:59









        Kenneth TruongKenneth Truong

        1,7251027




        1,7251027





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55040635%2fwhy-use-webpack-to-bundle-applications-that-run-in-node-environment%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to get text form Clipboard with JavaScript in Firefox 56?How to validate an email address in JavaScript?How do JavaScript closures work?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How do I copy to the clipboard in JavaScript?How do I include a JavaScript file in another JavaScript file?Get the current URL with JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?

            Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

            Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite