Preact-cli: native-url is aliased in webpack config but not in dependencies array

Created on 27 May 2020  Â·  3Comments  Â·  Source: preactjs/preact-cli


Do you want to request a _feature_ or report a _bug_?
bug

What is the current behaviour?
preact dev errors because webpack-dev-server attempts to import url, which is aliased to native-url (here) but not defined in preact-cli's dependencies (it is in devDependencies) - this was introduced in #1040.

If the current behaviour is a bug, please provide the steps to reproduce.

  1. Create a project with preact-cli
  2. npm run dev / npx preact watch
✖ ERROR ../node_modules/webpack-dev-server/client/utils/createSocketUrl.js
Module not found: Error: Can't resolve 'url' in './node_modules/webpack-dev-server/client/utils'
 @ ../node_modules/webpack-dev-server/client/utils/createSocketUrl.js 4:10-24
 @ ../node_modules/webpack-dev-server/client/index.js
 @ multi ../node_modules/preact-cli/lib/lib/entry webpack-dev-server/client webpack/hot/dev-server

What is the expected behaviour?
No errors occur.

Please mention other relevant information.
...

Please paste the results of preact info here.

Environment Info:
  System:
    OS: Linux 5.6 Antergos Linux
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
  Binaries:
    Node: 14.2.0 - /usr/bin/node
    Yarn: 1.22.4 - /usr/bin/yarn
    npm: 6.14.5 - /usr/bin/npm
  Browsers:
    Firefox: 76.0.1
  npmPackages:
    preact: ^10.3.2 => 10.4.4 
    preact-cli: ^3.0.0-rc.6 => 3.0.0-rc.13 
    preact-render-to-string: ^5.1.4 => 5.1.8 
    preact-router: ^3.2.1 => 3.2.1 

Most helpful comment

@ethanwu10 published 3.0.0-rc.14 with the fix for this.

All 3 comments

Should be fixed with #1203. Give it a test, if you have the time.

Yup, that fixes it.

@ethanwu10 published 3.0.0-rc.14 with the fix for this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ajay28kumar picture ajay28kumar  Â·  3Comments

zwrawr picture zwrawr  Â·  3Comments

AlStar01 picture AlStar01  Â·  3Comments

scottmas picture scottmas  Â·  3Comments

smjnab picture smjnab  Â·  3Comments