question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: a given Svelte example does not compile

See original GitHub issue

Trying to run Svelte example project I got:

ERROR in ./node_modules/@vime/svelte/src/lib.ts 1:30
Module parse failed: Unexpected token (1:30)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> export const define = (tagName: string, clazz: any) => {
|   const isClient = typeof window !== 'undefined';
|   if (isClient && !customElements.get(tagName))
 @ ./node_modules/@vime/svelte/src/svelte/Audio.svelte 17:0-32 20:0-33 102:0-6 103:0-6
 @ ./node_modules/@vime/svelte/src/svelte/index.js
 @ ./node_modules/@vime/svelte/src/svelte.js
 @ ./src/App.svelte
 @ ./src/main.ts
 @ multi ./src/main.ts

ERROR in ./node_modules/@vime/core/dist/custom-elements/index.js 20:15
Module parse failed: Unexpected token (20:15)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|     timeout = setTimeout(() => {
|       if (attempt === maxRetries) {
>         onFail?.();
|         return;
|       }
 @ ./node_modules/@vime/svelte/src/svelte.js 2:0-27 2:0-27
 @ ./src/App.svelte
 @ ./src/main.ts
 @ multi ./src/main.ts

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
gshilincommented, May 30, 2021

I don’t have that error, but this one:

./node_modules/@vime/core/dist/custom-elements/index.js 421:41
Module parse failed: Unexpected token (421:41)
File was processed with these loaders:
 * ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|   const registryId = Symbol('vmRegistryId');
|   const registrant = getRegistrant(ref);
>   registrant[COMPONENT_NAME_KEY] = name ?? registrant.nodeName.toLowerCase();
|   registrant[REGISTRATION_KEY] = registryId;

I use CRA, so I have no idea which version of webpack I use, but I have the following in package.json

    "@babel/cli": "^7.11.6",
    "@babel/core": "^7.11.6",
    "@babel/parser": "^7.11.5",
    "@babel/plugin-proposal-class-properties": "^7.4.4",
    "@babel/plugin-proposal-export-namespace-from": "^7.2.0",
    "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.1",
    "@babel/plugin-proposal-optional-chaining": "^7.11.0",
    "@babel/plugin-proposal-throw-expressions": "^7.2.0",
    "@babel/plugin-syntax-dynamic-import": "^7.2.0",
    "@babel/polyfill": "^7.11.5",
    "@babel/preset-env": "^7.11.5",
    "@babel/preset-react": "^7.0.0",
    "@babel/register": "^7.11.5",
    "@babel/types": "^7.11.5",

And node 14.17.0

1reaction
gshilincommented, Jun 9, 2021

This answer solved the problem: https://stackoverflow.com/questions/67551922/cra-react-leaflet-failed-to-compile

Open your package.json file

"browserslist": {
 "production": [
  ">0.2%",
  "not dead",
  "not op_mini all"
],
"development": [
  "last 1 chrome version",
  "last 1 firefox version",
  "last 1 safari version"
]
},

Replace it with following lines :

"browserslist": [
">0.2%",
"not dead",
"not op_mini all"
],

Now Delete node_modeules folder

npm install

npm start

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation
Complete documentation for Svelte.
Read more >
Fixing a bug in Svelte, from issue to pull request - YouTube
I found an obscure bug in Svelte, and thought I'd try to fix it live on Twitch. And I did! ... Your browser...
Read more >
How do I fix this random bug in svelte
I think you need to import it like import type { SidebarInfo } from "../static/sidebar" // Sidebar.ts export type SidebarInfo = {}.
Read more >
Contributing to Svelte - Fixing issue #4392
Of course, contributing to Svelte, does not mean to contribute only in code, ... I was combing through bugs on GitHub, and found...
Read more >
Why Svelte is the Next Big Thing in JavaScript Development
Svelte, however, doesn't use a virtual DOM, instead compiling code into tiny, pure Vanilla JS. As a result, the code works much faster...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found