Skip to content

Error: Dynamic require of "x" is not supported #2400

@lovasoa

Description

@lovasoa

Describe the bug

Upgrading to the latest version of sveltekit broke adapter-node for my application. Now the application works in development, but when packaged by adapter-node, it throws `` on start

Reproduction

It can be reproduced on lovasoa/sanipasse@79c310b

lovasoa/sanipasse@79c310b

Logs

file:///home/olojkine/dev/sanipasse/build/middlewares.js:26
  throw new Error('Dynamic require of "' + x + '" is not supported');
        ^

Error: Dynamic require of "crypto" is not supported
    at __require (file:///home/olojkine/dev/sanipasse/build/middlewares.js:26:9)
    at node_modules/@peculiar/webcrypto/build/webcrypto.js (file:///home/olojkine/dev/sanipasse/build/middlewares.js:8119:19)
    at __require2 (file:///home/olojkine/dev/sanipasse/build/middlewares.js:32:44)
    at node_modules/isomorphic-webcrypto/src/index.js (file:///home/olojkine/dev/sanipasse/build/middlewares.js:10253:22)
    at __require2 (file:///home/olojkine/dev/sanipasse/build/middlewares.js:32:44)
    at node_modules/isomorphic-webcrypto/src/main.js (file:///home/olojkine/dev/sanipasse/build/middlewares.js:10262:22)
    at __require2 (file:///home/olojkine/dev/sanipasse/build/middlewares.js:32:44)
    at file:///home/olojkine/dev/sanipasse/build/middlewares.js:10271:46
    at ModuleJob.run (node:internal/modules/esm/module_job:183:25)
    at async Loader.import (node:internal/modules/esm/loader:178:24)

System Info

System:
    OS: Linux 5.13 Fedora 34 (Workstation Edition) 34 (Workstation Edition)
    CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
    Memory: 2.64 GB / 15.28 GB
    Container: Yes
    Shell: 5.1.0 - /bin/bash
  Binaries:
    Node: 16.5.0 - /usr/bin/node
    Yarn: 1.22.10 - /usr/bin/yarn
    npm: 7.19.1 - /usr/bin/npm
  Browsers:
    Firefox: 91.0.2
  npmPackages:
    @sveltejs/adapter-node: next => 1.0.0-next.46 
    @sveltejs/adapter-static: next => 1.0.0-next.18 
    @sveltejs/kit: next => 1.0.0-next.165 
    svelte: ^3.38.3 => 3.42.5 

Severity

blocking all usage of SvelteKit

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp1-importantSvelteKit cannot be used by a large number of people, basic functionality is missing, etc.pkg:adapter-node

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions