Webpack doesn't work with 'module' field of in-direct dependenciesManaging jQuery plugin dependency in webpackWebpack - entry point common dependenciesWebpack 2: cannot resolve moduleWebpack: way to override ignored modules in package.json browser field?Field 'browser' doesn't contain a valid alias configurationWebpack 2 won't work when using ts-loaderImport angularjs modules with webpackwebpack bundled module is undefined when required by node`import username from './username.txt'` with typescript+webpack gives `undefined`efficient import export of modules with webpack and babel-loader - tree shaking not working

Classification of surfaces

Aligning equation numbers vertically

How much cash can I safely carry into the USA and avoid civil forfeiture?

A strange hotel

What is the most expensive material in the world that could be used to create Pun-Pun's lute?

Extension of 2-adic valuation to the real numbers

How to stop co-workers from teasing me because I know Russian?

What term is being referred to with "reflected-sound-of-underground-spirits"?

"The cow" OR "a cow" OR "cows" in this context

How can Republicans who favour free markets, consistently express anger when they don't like the outcome of that choice?

How to write a column outside the braces in a matrix?

Do I have an "anti-research" personality?

Contradiction proof for inequality of P and NP?

Why did C use the -> operator instead of reusing the . operator?

How to denote matrix elements succinctly?

Why didn't the Space Shuttle bounce back into space as many times as possible so as to lose a lot of kinetic energy up there?

Critique of timeline aesthetic

Re-entry to Germany after vacation using blue card

Should the Death Curse affect an undead PC in the Tomb of Annihilation adventure?

Was there a shared-world project before "Thieves World"?

bldc motor, esc and battery draw, nominal vs peak

How can I practically buy stocks?

Why does nature favour the Laplacian?

What does ゆーか mean?



Webpack doesn't work with 'module' field of in-direct dependencies


Managing jQuery plugin dependency in webpackWebpack - entry point common dependenciesWebpack 2: cannot resolve moduleWebpack: way to override ignored modules in package.json browser field?Field 'browser' doesn't contain a valid alias configurationWebpack 2 won't work when using ts-loaderImport angularjs modules with webpackwebpack bundled module is undefined when required by node`import username from './username.txt'` with typescript+webpack gives `undefined`efficient import export of modules with webpack and babel-loader - tree shaking not working






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have two modules which have only module field (points to an esm bundle file) in their package.json, and have no main field.



module2 uses module1, and I also created a demo project uses module2.



Since they both have module field, I specify the resolve.mainFields in the webpack config file in the demo project:



resolve: 
mainFields: ['module']



but when I run webpack in the demo project, only module2 is resolved correctly, and webpack can't find the bundle file of module1.



I created a demo project with complete code for this issue, please see:
https://github.com/freewind-demos/typescript-webpack-uses-esm-modules-demo/tree/issue



Hope to know where is wrong and make them work, thanks.










share|improve this question






























    0















    I have two modules which have only module field (points to an esm bundle file) in their package.json, and have no main field.



    module2 uses module1, and I also created a demo project uses module2.



    Since they both have module field, I specify the resolve.mainFields in the webpack config file in the demo project:



    resolve: 
    mainFields: ['module']



    but when I run webpack in the demo project, only module2 is resolved correctly, and webpack can't find the bundle file of module1.



    I created a demo project with complete code for this issue, please see:
    https://github.com/freewind-demos/typescript-webpack-uses-esm-modules-demo/tree/issue



    Hope to know where is wrong and make them work, thanks.










    share|improve this question


























      0












      0








      0








      I have two modules which have only module field (points to an esm bundle file) in their package.json, and have no main field.



      module2 uses module1, and I also created a demo project uses module2.



      Since they both have module field, I specify the resolve.mainFields in the webpack config file in the demo project:



      resolve: 
      mainFields: ['module']



      but when I run webpack in the demo project, only module2 is resolved correctly, and webpack can't find the bundle file of module1.



      I created a demo project with complete code for this issue, please see:
      https://github.com/freewind-demos/typescript-webpack-uses-esm-modules-demo/tree/issue



      Hope to know where is wrong and make them work, thanks.










      share|improve this question
















      I have two modules which have only module field (points to an esm bundle file) in their package.json, and have no main field.



      module2 uses module1, and I also created a demo project uses module2.



      Since they both have module field, I specify the resolve.mainFields in the webpack config file in the demo project:



      resolve: 
      mainFields: ['module']



      but when I run webpack in the demo project, only module2 is resolved correctly, and webpack can't find the bundle file of module1.



      I created a demo project with complete code for this issue, please see:
      https://github.com/freewind-demos/typescript-webpack-uses-esm-modules-demo/tree/issue



      Hope to know where is wrong and make them work, thanks.







      webpack module






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 23 at 3:37







      Freewind

















      asked Mar 22 at 17:13









      FreewindFreewind

      78.9k116319571




      78.9k116319571






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Finally I found the problem is the file name. The bundle name was .mjs, and I changed it to .something.js, it's OK now.






          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%2f55304711%2fwebpack-doesnt-work-with-module-field-of-in-direct-dependencies%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









            0














            Finally I found the problem is the file name. The bundle name was .mjs, and I changed it to .something.js, it's OK now.






            share|improve this answer



























              0














              Finally I found the problem is the file name. The bundle name was .mjs, and I changed it to .something.js, it's OK now.






              share|improve this answer

























                0












                0








                0







                Finally I found the problem is the file name. The bundle name was .mjs, and I changed it to .something.js, it's OK now.






                share|improve this answer













                Finally I found the problem is the file name. The bundle name was .mjs, and I changed it to .something.js, it's OK now.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 23 at 3:36









                FreewindFreewind

                78.9k116319571




                78.9k116319571





























                    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%2f55304711%2fwebpack-doesnt-work-with-module-field-of-in-direct-dependencies%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

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript