aurelia / webpack-plugin

A plugin for webpack that enables bundling Aurelia applications.
MIT License
90 stars 36 forks source link

[Webpack 5] path.normalize in DistPlugin breaks webpack-dev-server because of malformed url #179

Closed graycrow closed 3 years ago

graycrow commented 3 years ago

I'm submitting a bug report

Please tell us about your environment:

Current behavior: I'm upgrading from Webpack 4. I made a working config, which builds without errors, but breaks at dev run (au run or npm run start) with the following error: Uncaught SyntaxError: The URL 'https:/sockjs-node' is invalid.

I tracked it down to the following lines in DistPlugin: https://github.com/aurelia/webpack-plugin/blob/92f5d5d293f29f6748744370ac95ef4ccb8fc767/src/DistPlugin.ts#L39-L40

the determineRewrittenPath() function receives the following string as the input: Source/node_modules/webpack-dev-server/client/index.js?https://dev.example.com:8001 and returns the string with malformed query: Source/node_modules/webpack-dev-server/client/index.js?https:/dev.example.com:8001. Please notice only one slash in the https protocol definition.

If I remove both path.normalize calls, webpack-dev-server works fine.

Expected/desired behavior:

bigopon commented 3 years ago

Resolved by #180