cdellacqua / svelte-stack-router

Bridging the gap between Native Apps and WebApps. A Svelte Router that caches page components and will make your WebApp feel more native
MIT License
40 stars 6 forks source link

Error: Unexpected token #7

Closed easyfrog closed 3 years ago

easyfrog commented 3 years ago

I got this error when bundled:

[!] Error: Unexpected token
node_modules/svelte-stack-router/src/transition-functions.js (95:4)
93:         }
94:       `),
95:     ]);
        ^
96: }
97: export function dive(duration) {
Error: Unexpected token
    at error (/Users/easyfrog/work/svelte/ooomapProjects/node_modules/rollup/dist/shared/node-entry.js:5400:30)
    at Module.error (/Users/easyfrog/work/svelte/ooomapProjects/node_modules/rollup/dist/shared/node-entry.js:9824:16)
    at tryParse (/Users/easyfrog/work/svelte/ooomapProjects/node_modules/rollup/dist/shared/node-entry.js:9717:23)
    at Module.setSource (/Users/easyfrog/work/svelte/ooomapProjects/node_modules/rollup/dist/shared/node-entry.js:10080:33)
    at Promise.resolve.catch.then.then.then (/Users/easyfrog/work/svelte/ooomapProjects/node_modules/rollup/dist/shared/node-entry.js:12366:20)

this is dependencies:

  "devDependencies": {
    "@types/three": "^0.127.1",
    "crypto-js": "^3.1.9-1",
    "es6-shim": "^0.35.5",
    "fastq": "^1.6.0",
    "fs-extra": "^8.1.0",
    "globby": "^10.0.1",
    "gulp": "^3.9.1",
    "gulp-rename": "^1.4.0",
    "gulp-replace": "^1.0.0",
    "npm-run-all": "^4.1.5",
    "page": "^1.11.6",
    "rimraf": "^3.0.2",
    "rollup": "^1.12.0",
    "rollup-plugin-buble": "^0.19.8",
    "rollup-plugin-commonjs": "^10.1.0",
    "rollup-plugin-javascript-obfuscator": "^1.0.4",
    "rollup-plugin-livereload": "^1.0.4",
    "rollup-plugin-node-resolve": "^5.2.0",
    "rollup-plugin-svelte": "^5.1.1",
    "rollup-plugin-terser": "^4.0.4",
    "run-parallel": "^1.1.9",
    "svelte": "^3.42.5",
    "svelte-stack-router": "^2.4.4",
    "yargs": "^14.2.0"
  }
node: v10.16.0
npm: 6.9.0
cdellacqua commented 3 years ago

Can you share your rollup.config.js? It's often the case that these types of errors occur when plugins are not processed in the right order. You can also have a look at this as an example: rollup.preview.config.js, it's the configuration used in the demo.

If that doesn't solve your problem, the error could also be caused by out-of-date rollup plugins, I can see that some of those in your package.json are deprecated. A lot of them have been moved to the @rollup/ namespace, like @rollup/plugin-commonjs.

Also, the current LTS of Node.js is version 14, you can check if updating that fixes the problem.