single-spa / single-spa-react

Single-spa lifecycles helper for React applications
https://single-spa.js.org/docs/ecosystem-react.html
MIT License
227 stars 63 forks source link

Build fails after last update (5.1.0) #173

Closed ShakMR closed 1 year ago

ShakMR commented 1 year ago

After updating 1 hour ago we started getting this error in the build step.

Module not found: Error: Can't resolve 'single-spa-react' in 'project/src'
resolve 'single-spa-react' in 'project/src'
  Parsed request is a module
  using description file: project/package.json (relative path: ./src)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      project/src/node_modules doesn't exist or is not a directory
      looking for modules in project/node_modules
        single file module
          using description file: project/package.json (relative path: ./node_modules/single-spa-react)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              project/node_modules/single-spa-react is not a file
            .mjs
              Field 'browser' doesn't contain a valid alias configuration
              project/node_modules/single-spa-react.mjs doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              project/node_modules/single-spa-react.js doesn't exist
            .jsx
              Field 'browser' doesn't contain a valid alias configuration
              project/node_modules/single-spa-react.jsx doesn't exist
            .wasm
              Field 'browser' doesn't contain a valid alias configuration
              project/node_modules/single-spa-react.wasm doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              project/node_modules/single-spa-react.json doesn't exist
        existing directory project/node_modules/single-spa-react
          using description file: project/node_modules/single-spa-react/package.json (relative path: .)
            using exports field: ./lib/esm/single-spa-react.js
              using description file: project/node_modules/single-spa-react/package.json (relative path: ./lib/esm/single-spa-react.js)
                no extension
                  Field 'browser' doesn't contain a valid alias configuration
                  project/node_modules/single-spa-react/lib/esm/single-spa-react.js doesn't exist
                .mjs
                  Field 'browser' doesn't contain a valid alias configuration
                  project/node_modules/single-spa-react/lib/esm/single-spa-react.js.mjs doesn't exist
                .js
                  Field 'browser' doesn't contain a valid alias configuration
                  project/node_modules/single-spa-react/lib/esm/single-spa-react.js.js doesn't exist
                .jsx
                  Field 'browser' doesn't contain a valid alias configuration
                  project/node_modules/single-spa-react/lib/esm/single-spa-react.js.jsx doesn't exist
                .wasm
                  Field 'browser' doesn't contain a valid alias configuration
                  project/node_modules/single-spa-react/lib/esm/single-spa-react.js.wasm doesn't exist
                .json
                  Field 'browser' doesn't contain a valid alias configuration
                  project/node_modules/single-spa-react/lib/esm/single-spa-react.js.json doesn't exist
                as directory
                  project/node_modules/single-spa-react/lib/esm/single-spa-react.js doesn't exist
      /Users/ikea-boari/Projects/IKEA/mfe/node_modules doesn't exist or is not a directory
      /Users/ikea-boari/Projects/IKEA/node_modules doesn't exist or is not a directory
      /Users/ikea-boari/Projects/node_modules doesn't exist or is not a directory
      /Users/ikea-boari/node_modules doesn't exist or is not a directory
      /Users/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory

webpack 5.87.0 compiled with 1 error in 2382 ms
marcosgilf commented 1 year ago

The package seems to have an error in the publish step. The generated code in node_modules is not complete: single-spa-react-output

alanmatiasdev commented 1 year ago

I also faced this error. Version 5.1.0 only includes library typing.

Screenshot 2023-06-21 at 10 34 45

lhtdesignde commented 1 year ago

Getting the same error after upgrading. node_modules missing?

abhinavairi commented 1 year ago

The package seems to have an error in the publish step. The generated code in node_modules is not complete: single-spa-react-output

In all package versions i.e. ^5.0.0, ^5.0.1, ^5.0.2 and ^5.1.0 after installing it doesn't include lib and parcel folder. Have to downgrade to ^4.6.1 to make it work in application.

alanmatiasdev commented 1 year ago

The package seems to have an error in the publish step. The generated code in node_modules is not complete: single-spa-react-output

In all package versions i.e. ^5.0.0, ^5.0.1, ^5.0.2 and ^5.1.0 after installing it doesn't include lib and parcel folder. Have to downgrade to ^4.6.1 to make it work in application.

Version 5.0.2 has the library files. Remove node modules and lock file to install it

Screenshot 2023-06-22 at 07 06 43

abhinavairi commented 1 year ago

The package seems to have an error in the publish step. The generated code in node_modules is not complete: single-spa-react-output

In all package versions i.e. ^5.0.0, ^5.0.1, ^5.0.2 and ^5.1.0 after installing it doesn't include lib and parcel folder. Have to downgrade to ^4.6.1 to make it work in application.

Version 5.0.2 has the library files. Remove node modules and lock file to install it

Screenshot 2023-06-22 at 07 06 43

Agree only ^5.1.0 has issue

wataruoguchi commented 1 year ago

Same. Confirmed with Yarn 3. Downgraded to version 5.0.2 works fine.

I am not sure if this is related to this, but even with version 5.0.2, the following settings failed with single-spa-react:

Changing the moduleResolution to "Node" is the workaround.

joeldenning commented 1 year ago

My guess is that this is related to https://github.com/single-spa/single-spa-react/pull/168

joeldenning commented 1 year ago

The autopublishing feature also might have messed with the folders that were published to npm. I have stopped all the autopublishing and am publishing manually now.

162

165

joeldenning commented 1 year ago

@darshkpatel do you know what could have caused this? I will attempt to replicate this and find a fix, but don't have a lot of work time budgeted for open source right now.

darshkpatel commented 1 year ago

I tried checking out to v5.1.0 tag and running pnpm build it does generate the parcel and lib folders What steps do you use to publish manually ?

joeldenning commented 1 year ago

Ah I misread the issue. I thought the publish error only occurred with the previous versions rather than 5.1.0, and thought the issue was related to the package.json export rather than publishing. I have published version 5.1.1 which has the lib and parcel folders

joeldenning commented 1 year ago

I've confirmed that version 5.1.1 works with a fresh create-single-spa project.

joeldenning commented 1 year ago

I think the reason 5.1.0 had a bad publish is that I did it from a new computer and something might have been misconfigured. The package.json files property has lib and parcel listed, so I don't know why they weren't included. I published 5.1.1 from my normal work computer and it was fine - pnpm pack showed that the lib and parcel folders were to be included