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

"svelte": "^3.32.1" Could not add svelte compiler: #138

Closed
Valexr opened this issue Feb 8, 2021 · 2 comments
Closed

"svelte": "^3.32.1" Could not add svelte compiler: #138

Valexr opened this issue Feb 8, 2021 · 2 comments

Comments

@Valexr
Copy link

Valexr commented Feb 8, 2021

After update SvelteJS to 3.32.1 version & plenty build

errs.go:8: Could not add svelte compiler: ReferenceError: require is not defined
Please create a valid Plenti project or fix your app structure before trying to run this command again.
Error: runtime error: invalid memory address or nil pointer dereference

@jimafisk
Copy link
Member

Thanks for the bug report @Valexr, I see this too. The newer versions of Svelte introduce a few things we need to preprocess in order to run in v8.

On line 22647 of node_modules/svelte/compiler.js there's a commonjs require statement const Url$1 = (typeof URL !== 'undefined' ? URL : require('url').URL); that we need to remove.

Also starting on line 1673 in node_modules/svelte/internal/index.mjs there are a few examples now listed in the comments. Some of our static import regexp was picking up on these, so I updated them to only pull the import statement if its the first character in the line per https://stackoverflow.com/questions/57256550/regular-expression-with-beginning-of-line

It would be great if we could pull newer versions of Svelte in a more predictable way, but it's being written for a NodeJS environment and we unfortunately don't have all of those tools in V8go.

@jimafisk
Copy link
Member

Should be all set in v0.3.17: https://github.com/plentico/plenti/releases/tag/v0.3.17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants