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

Plugin Error Unexpected token (5:22896) in ..\node_modules\@stencil\state-tunnel\dist\esm\es5\stencil-state-tunnel.core.js #1063

Closed
MoAsmar opened this issue Sep 5, 2018 · 12 comments
Assignees
Labels

Comments

@MoAsmar
Copy link

MoAsmar commented Sep 5, 2018

Stencil version:
@stencil/core@0.9.11

I'm submitting a:
[ x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/

Current behavior:
npm run build failed, below is the error:

[ ERROR ] Plugin Error
Unexpected token (5:22896) in
C:\Workarea\app\node_modules@stencil\state-tunnel\dist\esm\es5\stencil-state-tunnel.core.js

Expected behavior:
Build

package.json:

{
  "name": "myapp",
  "version": "0.0.123",
  "description": "component",
  "main": "dist/index.js",
  "types": "dist/types/components.d.ts",
  "collection": "dist/collection/collection-manifest.json",
  "files": [
    "dist/"
  ],
  "module": "dist/index.js",
  "scripts": {
    "build": "stencil build --prerender",
    "dev": "sd concurrent \"stencil build --dev --watch\" \"stencil-dev-server\" ",
    "serve": "stencil-dev-server",
    "start": "npm run dev",
    "test": "jest --no-cache",
    "test.watch": "jest --watch --no-cache"
  },
  "dependencies": {
    "@stencil/router": "^0.2.2",
    "@stencil/sass": "0.0.3",
    "@types/jquery": "^3.3.4"
  },
  "devDependencies": {
    "@stencil/core": "^0.9.11",
    "@stencil/dev-server": "latest",
    "@stencil/utils": "latest",
    "@types/jest": "^21.1.1",
    "jest": "^21.2.1"
  },
  "jest": {
    "transform": {
      "^.+\\.(ts|tsx)$": "<rootDir>/node_modules/@stencil/core/testing/jest.preprocessor.js"
    },
    "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js",
      "json",
      "jsx"
    ]
  }
}

Other information:

@ionitron-bot ionitron-bot bot added the triage label Sep 5, 2018
@MoAsmar
Copy link
Author

MoAsmar commented Sep 6, 2018

it seems the issue was because of a missing folder './stencil' but I don't know why it got stuck here, i had to clone the repo in another folder and install deps to get it working.

@jthoms1
Copy link
Member

jthoms1 commented Sep 6, 2018

Was the error thrown during prerender?

@jthoms1 jthoms1 self-assigned this Sep 6, 2018
@ryanwatkins
Copy link

Saw a similar error, with one component that imported another. Deleting the .stencil directories fixed the issue.

@tomsaunders
Copy link

After a lot of debug logging the stencil build script to try to work out where this was coming from, I got past this problem by specifying 0.2.5 for the @stencil/router dependency.

@MoAsmar
Copy link
Author

MoAsmar commented Sep 7, 2018

Thanks @tomsaunders & @ryanwatkins, doing both solutions fixed the issue.

@MoAsmar
Copy link
Author

MoAsmar commented Sep 7, 2018

@jthoms1 it was thrown on 'npm start'
image

@rjacobson16
Copy link

rjacobson16 commented Sep 7, 2018

Sorry, which .stencil directories do you mean? Having the same issue, already using router 0.2.5

@ryanwatkins
Copy link

In my case its the .stencil cache directory created by the compiler in the root of the component folder.

@Gafilipoie
Copy link

I'm experiencing the same issue, my stancil core is 0.11.2

@jthoms1
Copy link
Member

jthoms1 commented Sep 8, 2018

If you are using Router 0.2.6 please use a version of Stencil later than 0.11.4. This release had a breaking change to how functional components work. The latest release of router was updated to work with the newer Functional Component interface but in doing so it is no longer backward compatible.

More details on the change can be read here.

https://github.com/ionic-team/stencil/blob/master/CHANGELOG.md#-0114-2018-08-12

@MoAsmar
Copy link
Author

MoAsmar commented Sep 10, 2018

I already fixed it by updating stencil to 0.11.4 and router to 0.2.5, thanks @jthoms1

@jthoms1 jthoms1 closed this as completed Sep 10, 2018
@MoAsmar
Copy link
Author

MoAsmar commented Sep 21, 2018

a little advice if it still happens even if you update stencil to 0.11.4 and router to 0.2.5, try to run:
npm cache clear --force

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

No branches or pull requests

6 participants