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

[2.0] Svelte-kit prerender issue: ReferenceError: require is not defined in ES module scope, you can use import instead #23

Closed
gyurielf opened this issue Aug 21, 2022 · 2 comments · Fixed by #25
Assignees
Labels
bug Something isn't working sveltekit version 2.x

Comments

@gyurielf
Copy link

gyurielf commented Aug 21, 2022

Hello there!

First of all, thanks for the new version!

I got this message when I try to build (prerender) my app with adapter-static, with the 2.0 version.
ReferenceError: require is not defined in ES module scope, you can use import instead.

I guess the problem somewhere around createEncryptedStorage, based on the logs.

 const [i2, o2, s2] = await Promise.all([n3.hexToBuffer(r3[0]), n3.hexToBuffer(e3[0]), n3.hexToBuffer(e3[1])]), a2 = await n3.decipher(t3, i2, s2, o2);
    return await n3.bufferToString(a2);
  } };
  if ("undefined" == typeof window) {
    const e3 = require("util"), r3 = require("crypto"), t3 = e3.promisify(r3.pbkdf2), i2 = e3.promisify(r3.randomBytes);
    n2.normalizeHash = function(e4) {
      return e4.replace("-", "").toLowerCase();
    }, n2.normalizeAlgorithm = function(e4) {
      return 0 !== e4.toLowerCase().indexOf("aes") ? e4 : e4.toLowerCase();
...    
@MacFJA
Copy link
Owner

MacFJA commented Aug 27, 2022

I'm working on a fix for this.
I'm almost done, but I have a regression on the cookie storage that I have to figure out

@MacFJA MacFJA added the bug Something isn't working label Aug 27, 2022
@MacFJA MacFJA self-assigned this Aug 27, 2022
@MacFJA MacFJA closed this as completed in #25 Sep 4, 2022
@MacFJA
Copy link
Owner

MacFJA commented Sep 4, 2022

@gyurielf The new version 2.1.0 should solve the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sveltekit version 2.x
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants