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

packages with main files that are not JavaScript are breaking acorn (v0.10.0 alpha) #484

Closed
1 of 5 tasks
thescientist13 opened this issue Feb 27, 2021 · 0 comments · Fixed by #485
Closed
1 of 5 tasks
Assignees
Labels
alpha.7 bug Something isn't working CLI P0 Critical issue that should get addressed ASAP v0.10.0

Comments

@thescientist13
Copy link
Member

thescientist13 commented Feb 27, 2021

Type of Change

  • New Feature Request
  • Documentation / Website
  • Improvement / Suggestion
  • Bug
  • Other (please clarify below)

Summary

Was testing with the package simpledotcss which has a package.json#main file like this

{
  "main": "simple.css",
}

and was getting this error when running yarn develop

Started local development server at localhost:1984
dependency simpledotcss
packageEntryPointPath /Users/owenbuckley/Workspace/project-evergreen/repos/greenwood-getting-started/node_modules/simpledotcss/simple.css

  SyntaxError: Unexpected token (2:0)
      at Parser.pp$4.raise (/Users/owenbuckley/Workspace/project-evergreen/repos/greenwood-getting-started/node_modules/acorn/dist/acorn.js:3014:15)
      at Parser.pp.unexpected (/Users/owenbuckley/Workspace/project-evergreen/repos/greenwood-getting-started/node_modules/acorn/dist/acorn.js:706:10)
      at Parser.pp$3.parseExprAtom (/Users/owenbuckley/Workspace/project-evergreen/repos/greenwood-getting-started/node_modules/acorn/dist/acorn.js:2413:12)
      at Parser.pp$3.parseExprSubscripts (/Users/owenbuckley/Workspace/project-evergreen/repos/greenwood-getting-started/node_modules/acorn/dist/acorn.js:2216:21)
      at Parser.pp$3.parseMaybeUnary (/Users/owenbuckley/Workspace/project-evergreen/repos/greenwood-getting-started/node_modules/acorn/dist/acorn.js:2193:19)
      at Parser.pp$3.parseExprOps (/Users/owenbuckley/Workspace/project-evergreen/repos/greenwood-getting-started/node_modules/acorn/dist/acorn.js:2128:21)
      at Parser.pp$3.parseMaybeConditional (/Users/owenbuckley/Workspace/project-evergreen/repos/greenwood-getting-started/node_modules/acorn/dist/acorn.js:2111:21)
      at Parser.pp$3.parseMaybeAssign (/Users/owenbuckley/Workspace/project-evergreen/repos/greenwood-getting-started/node_modules/acorn/dist/acorn.js:2079:21)
      at Parser.pp$3.parseExpression (/Users/owenbuckley/Workspace/project-evergreen/repos/greenwood-getting-started/node_modules/acorn/dist/acorn.js:2045:21)
      at Parser.pp$1.parseStatement (/Users/owenbuckley/Workspace/project-evergreen/repos/greenwood-getting-started/node_modules/acorn/dist/acorn.js:894:47)

Details

This makes sense given we are just assuming all packages in package.json are JavaScript based and so feeding a CSS file into acorn will break and also does not make sense for that getting put into an importMap.

Object.keys(packageJson.dependencies || {}).forEach(dependency => {
  ...

  walkModule(packageEntryModule, dependency);
  importMap[dependency] = `/node_modules/${dependency}/${entry}`;
  walkPackageJson(dependencyPackageJson);
});

Will just need to do some basic filtering of packages we put into the importMap.

@thescientist13 thescientist13 added bug Something isn't working P0 Critical issue that should get addressed ASAP CLI labels Feb 27, 2021
@thescientist13 thescientist13 self-assigned this Feb 27, 2021
@thescientist13 thescientist13 moved this from IN PROGRESS to IN REVIEW in 5 - Architectural Digest Feb 27, 2021
@thescientist13 thescientist13 linked a pull request Feb 27, 2021 that will close this issue
@thescientist13 thescientist13 mentioned this issue Mar 5, 2021
12 tasks
@thescientist13 thescientist13 moved this from IN REVIEW to DONE in 5 - Architectural Digest Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alpha.7 bug Something isn't working CLI P0 Critical issue that should get addressed ASAP v0.10.0
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

1 participant