sveltejs / sapper

The next small thing in web development, powered by Svelte
https://sapper.svelte.dev
MIT License
7.01k stars 435 forks source link

Sapper doesn't work with Webpack 5 #1739

Closed tvanc closed 3 years ago

tvanc commented 3 years ago

Describe the bug Sapper's dev script fails when Webpack is updated to version 5.

To Reproduce Example repo with steps below already completed.

  1. Install Sapper with webpack.
    npx degit sveltejs/sapper-template#webpack
  2. update all dependencies to their latest version, then install
    npm install -g npm-check-updates
    ncu -u
    npm i
  3. run dev script
    npm run dev
  4. optionally try adding the configuration options described in the svelte-loader readme as required for use with Webpack 5
  5. Observe the errors below in the console
Console Output $ npm run dev > TODO@0.0.1 dev C:\Users\User\PhpstormProjects\sapper-temp > sapper dev (node:18652) [DEP_WEBPACK_TEMPLATE_PATH_PLUGIN_REPLACE_PATH_VARIABLES_HASH] DeprecationWarning: [hash] is now [fullhash] (also consider using [chunkhash] or [contenthash], see documentation for details) (Use `node --trace-deprecation ...` to show where the warning was created) ✗ client resolve 'internal/shared' in 'C:\Users\User\PhpstormProjects\sapper-temp\src\node_modules\@sapper' using description file: C:\Users\User\PhpstormProjects\sapper-temp\package.json (relative path: ./src/node_modules/@sapper) Field 'browser' doesn't contain a valid alias configuration using description file: C:\Users\User\PhpstormProjects\sapper-temp\package.json (relative path: ./src/node_modules/@sapper/internal/shared) Field 'browser' doesn't contain a valid alias configuration C:\Users\User\PhpstormProjects\sapper-temp\src\node_modules\@sapper\internal\shared doesn't exist ✗ server resolve 'internal/manifest-server' in 'C:\Users\User\PhpstormProjects\sapper-temp\src\node_modules\@sapper' using description file: C:\Users\User\PhpstormProjects\sapper-temp\package.json (relative path: ./src/node_modules/@sapper) using description file: C:\Users\User\PhpstormProjects\sapper-temp\package.json (relative path: ./src/node_modules/@sapper/internal/manifest-server) C:\Users\User\PhpstormProjects\sapper-temp\src\node_modules\@sapper\internal\manifest-server doesn't exist ✔ service worker (76ms) webpack://TODO/./src/node_modules/@sapper/server.mjs?:9 Object(function webpackMissingModule() { var e = new Error("Cannot find module './internal/manifest-server'"); e.cod e = 'MODULE_NOT_FOUND'; throw e; }()); ^ Error: Cannot find module './internal/manifest-server'

Expected behavior Smooth operation

Information about my Sapper Installation:

$ npx envinfo --system --npmPackages svelte,sapper,rollup,webpack --binaries --browsers npx: installed 1 in 2.654s System: OS: Windows 10 10.0.18363 CPU: (8) x64 Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz Memory: 5.24 GB / 15.98 GB Binaries: Node: 14.13.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.5 - ~\.yarn\bin\yarn.CMD npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD Browsers: Chrome: 88.0.4324.190 Edge: Spartan (44.18362.449.0) Internet Explorer: 11.0.18362.1 npmPackages: sapper: ^0.29.1 => 0.29.1 svelte: ^3.35.0 => 3.35.0 webpack: ^5.24.3 => 5.24.3

Severity This blocks upgrading and is a significant issue that I believe needs to be solved.

antony commented 3 years ago

Thanks for this. Since Sapper is now in maintenance mode, we are unlikely to be looking to address this. We also tend to recommend Rollup vs Webpack for bundling, so any Webpack upgrades would really be better provided as a PR from the community. There is no intention from the Svelte maintainers to support Webpack 5 at this time.