Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to webpack 5 #1059

Closed
wants to merge 12 commits into from
Closed

Conversation

jmorag
Copy link
Contributor

@jmorag jmorag commented Sep 2, 2021

I've been playing around with building this as an esm module and a necessary prerequisite is to upgrade to webpack 5 which supports that. Haven't gotten the esm stuff working yet, but this is nice to have on its own.

@sschmidTU
Copy link
Contributor

Nice! We'll test this.
What does stream: false do? (in resolve.fallback)

I hope we don't run into compatibility problems like this one:
diegomura/react-pdf#1029

@jmorag
Copy link
Contributor Author

jmorag commented Sep 2, 2021

Without it we get this:

ERROR in ./node_modules/jszip/lib/readable-stream-browser.js 9:0-34
Module not found: Error: Can't resolve 'stream' in '/home/joseph/Projects/opensheetmusicdisplay/node_modules/jszip/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
	- install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "stream": false }
resolve 'stream' in '/home/joseph/Projects/opensheetmusicdisplay/node_modules/jszip/lib'
  Parsed request is a module
  using description file: /home/joseph/Projects/opensheetmusicdisplay/node_modules/jszip/package.json (relative path: ./lib)
    resolve as module
      /home/joseph/Projects/opensheetmusicdisplay/node_modules/jszip/lib/node_modules doesn't exist or is not a directory
      /home/joseph/Projects/opensheetmusicdisplay/node_modules/jszip/node_modules doesn't exist or is not a directory
      /home/joseph/Projects/opensheetmusicdisplay/node_modules/node_modules doesn't exist or is not a directory
      looking for modules in /home/joseph/Projects/opensheetmusicdisplay/node_modules
        single file module
          using description file: /home/joseph/Projects/opensheetmusicdisplay/package.json (relative path: ./node_modules/stream)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /home/joseph/Projects/opensheetmusicdisplay/node_modules/stream doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /home/joseph/Projects/opensheetmusicdisplay/node_modules/stream.ts doesn't exist
            .tsx
              Field 'browser' doesn't contain a valid alias configuration
              /home/joseph/Projects/opensheetmusicdisplay/node_modules/stream.tsx doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /home/joseph/Projects/opensheetmusicdisplay/node_modules/stream.js doesn't exist
        /home/joseph/Projects/opensheetmusicdisplay/node_modules/stream doesn't exist
      /home/joseph/Projects/node_modules doesn't exist or is not a directory
      /home/joseph/node_modules doesn't exist or is not a directory
      /home/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
 @ ./node_modules/jszip/lib/support.js 35:27-62
 @ ./node_modules/jszip/lib/index.js 40:16-36
 @ ./src/Common/FileIO/Mxl.ts 8:32-48
 @ ./src/OpenSheetMusicDisplay/OpenSheetMusicDisplay.ts 16:14-45
 @ ./demo/index.js 1:0-91 431:36-57 514:44-65

We probably actually want the polyfill instead of just disabling it. I'll add that.

@sschmidTU
Copy link
Contributor

Already migrated in #1105.

@sschmidTU sschmidTU closed this Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants