webpack 5.70 vomits uncontrollably

Description

Summary: lock to webpack v5.69.1

Details: webpack 5.69.0 and 5.70.0 contain a change to "handle multiple alternative directories (e. g. due to resolve.alias or resolve.modules) when creating an context module" that cause resolution problems with moment's locale bundling. I think the relevant issue is #5492 where the author notes that the way the ecosystem has changed with the advent of ESM modules is basically at odds with the way moment handles locales. 

For stripes-smart-components and possibly some others, test output is prefixed with ~7k lines of errors, first like this:

{     moduleIdentifier: '/Users/zburke/projects/folio-org/stripes-smart-components/node_modules/moment/locale|/Users/zburke/projects/folio-org/stripes-smart-components/node_modules/moment/locale|lazy|/(en)/|groupOptions: {}|namespace object',     moduleName: './node_modules/moment/locale/ ./node_modules/moment/locale/ lazy (en) namespace object',     loc: 'moment/locale/af',     message: "Module not found: Error: Can't resolve '/Users/zburke/projects/folio-org/stripes-smart-components/node_modules/moment/locale/moment/locale/af' in '/Users/zburke/projects/folio-org/stripes-smart-components'",     moduleId: './node_modules/moment/locale ./node_modules/moment/locale lazy recursive (en)',     moduleTrace: [       [Object], [Object],       [Object], [Object],       [Object], [Object],       [Object]     ],     details: "resolve '/Users/zburke/projects/folio-org/stripes-smart-components/node_modules/moment/locale/moment/locale/af' in '/Users/zburke/projects/folio-org/stripes-smart-components'\n" +       '  using description file: /Users/zburke/projects/folio-org/stripes-smart-components/package.json (relative path: .)\n' +       "    Field 'browser' doesn't contain a valid alias configuration\n" +       '    root path /Users/zburke/projects/folio-org/stripes-smart-components\n' +       '      using description file: /Users/zburke/projects/folio-org/stripes-smart-components/package.json (relative path: ./Users/zburke/projects/folio-org/stripes-smart-components/node_modules/moment/locale/moment/locale/af)\n' +       '        no extension\n' +       "          Field 'browser' doesn't contain a valid alias configuration\n" +       "          /Users/zburke/projects/folio-org/stripes-smart-components/Users/zburke/projects/folio-org/stripes-smart-components/node_modules/moment/locale/moment/locale/af doesn't exist\n" +       '        .js\n' +       "          Field 'browser' doesn't contain a valid alias configuration\n" +       "          /Users/zburke/projects/folio-org/stripes-smart-components/Users/zburke/projects/folio-org/stripes-smart-components/node_modules/moment/locale/moment/locale/af.js doesn't exist\n" +       '        .json\n' +       "          Field 'browser' doesn't contain a valid alias configuration\n" +       "          /Users/zburke/projects/folio-org/stripes-smart-components/Users/zburke/projects/folio-org/stripes-smart-components/node_modules/moment/locale/moment/locale/af.json doesn't exist\n" +       '        .tsx\n' +       "          Field 'browser' doesn't contain a valid alias configuration\n" +       "          /Users/zburke/projects/folio-org/stripes-smart-components/Users/zburke/projects/folio-org/stripes-smart-components/node_modules/moment/locale/moment/locale/af.tsx doesn't exist\n" +       '        css\n' +       "          Field 'browser' doesn't contain a valid alias configuration\n" +       "          /Users/zburke/projects/folio-org/stripes-smart-components/Users/zburke/projects/folio-org/stripes-smart-components/node_modules/moment/locale/moment/locale/afcss doesn't exist\n" +       '        as directory\n' +       "          /Users/zburke/projects/folio-org/stripes-smart-components/Users/zburke/projects/folio-org/stripes-smart-components/node_modules/moment/locale/moment/locale/af doesn't exist\n" +       '    using description file: /Users/zburke/projects/folio-org/stripes-smart-components/node_modules/moment/package.json (relative path: ./locale/moment/locale/af)\n' +       '      no extension\n' +       "        Field 'browser' doesn't contain a valid alias configuration\n" +       "        /Users/zburke/projects/folio-org/stripes-smart-components/node_modules/moment/locale/moment/locale/af doesn't exist\n" +       '      .js\n' +       "        Field 'browser' doesn't contain a valid alias configuration\n" +       "        /Users/zburke/projects/folio-org/stripes-smart-components/node_modules/moment/locale/moment/locale/af.js doesn't exist\n" +       '      .json\n' +       "        Field 'browser' doesn't contain a valid alias configuration\n" +       "        /Users/zburke/projects/folio-org/stripes-smart-components/node_modules/moment/locale/moment/locale/af.json doesn't exist\n" +       '      .tsx\n' +       "        Field 'browser' doesn't contain a valid alias configuration\n" +       "        /Users/zburke/projects/folio-org/stripes-smart-components/node_modules/moment/locale/moment/locale/af.tsx doesn't exist\n" +       '      css\n' +       "        Field 'browser' doesn't contain a valid alias configuration\n" +       "        /Users/zburke/projects/folio-org/stripes-smart-components/node_modules/moment/locale/moment/locale/afcss doesn't exist\n" +       '      as directory\n' +       "        /Users/zburke/projects/folio-org/stripes-smart-components/node_modules/moment/locale/moment/locale/af doesn't exist",     stack: "ModuleNotFoundError: Module not found: Error: Can't resolve '/Users/zburke/projects/folio-org/stripes-smart-components/node_modules/moment/locale/moment/locale/af' in '/Users/zburke/projects/folio-org/stripes-smart-components'\n" +       '    at /Users/zburke/projects/folio-org/stripes-smart-components/node_modules/webpack/lib/Compilation.js:2014:28\n' +       '    at /Users/zburke/projects/folio-org/stripes-smart-components/node_modules/webpack/lib/NormalModuleFactory.js:791:13\n' +       '    at eval (eval at create (/Users/zburke/projects/folio-org/stripes-smart-components/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)\n' +       '    at /Users/zburke/projects/folio-org/stripes-smart-components/node_modules/webpack/lib/NormalModuleFactory.js:265:22\n' +       '    at eval (eval at create (/Users/zburke/projects/folio-org/stripes-smart-components/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)\n' +       '    at /Users/zburke/projects/folio-org/stripes-smart-components/node_modules/webpack/lib/NormalModuleFactory.js:427:22\n' +       '    at /Users/zburke/projects/folio-org/stripes-smart-components/node_modules/webpack/lib/NormalModuleFactory.js:111:11\n' +       '    at /Users/zburke/projects/folio-org/stripes-smart-components/node_modules/webpack/lib/NormalModuleFactory.js:663:25\n' +       '    at /Users/zburke/projects/folio-org/stripes-smart-components/node_modules/webpack/lib/NormalModuleFactory.js:848:8\n' +       '    at /Users/zburke/projects/folio-org/stripes-smart-components/node_modules/webpack/lib/NormalModuleFactory.js:968:5'   },

and then like this:

WARNING in ./node_modules/moment/locale/ ./node_modules/moment/locale/ lazy (en) namespace object moment/locale/af Module not found: Error: Can't resolve '/Users/zburke/projects/folio-org/stripes-smart-components/node_modules/moment/locale/moment/locale/af' in '/Users/zburke/projects/folio-org/stripes-smart-components'  @ ./node_modules/@folio/stripes-core/src/loginServices.js 124:4-49  @ ./node_modules/@folio/stripes-core/index.js 12:0-75 12:0-75 12:0-75 30:0-55 30:0-55 31:0-64 31:0-64 32:0-55 32:0-55  @ ./lib/ClipCopy/ClipCopy.js 5:0-53 11:27-41  @ ./lib/ sync ^(?%21.*(stories%7Cexamples)).*\.js$ ./ClipCopy/ClipCopy.js  @ ./tests/index.js 10:24-92

once of each for each locale.

Environment

None

Potential Workaround

None

Checklist

hide

TestRail: Results

Activity

Show:
Done

Details

Assignee

Reporter

Priority

Story Points

Sprint

Development Team

Prokopovych

Fix versions

TestRail: Cases

Open TestRail: Cases

TestRail: Runs

Open TestRail: Runs
Created April 1, 2022 at 6:19 PM
Updated December 20, 2022 at 4:05 PM
Resolved April 1, 2022 at 6:57 PM
TestRail: Cases
TestRail: Runs

Flag notifications