[BUG] Example Dangerfile does not parse with a vue-cli app
See original GitHub issueDescribe the bug
When using Danger with an app generated with vue-cli, the example Dangerfile from the documentation fails to parse with SyntaxError: cannot use import statement outside a module
.
The output in the GitLab CI log:
$ yarn run danger ci --failOnErrors
yarn run v1.22.5
$ /builds/unikitty37/danger-demo/node_modules/.bin/danger ci --failOnErrors
Unable to evaluate the Dangerfile
dangerfile.js:1
import "core-js/modules/es.array.join";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:991:16)
at Module._compile (internal/modules/cjs/loader.js:1039:27)
at Object.requireFromString [as default] (/builds/unikitty37/danger-demo/node_modules/require-from-string/index.js:28:4)
at Object.<anonymous> (/builds/unikitty37/danger-demo/node_modules/danger/distribution/runner/runners/inline.js:144:63)
at step (/builds/unikitty37/danger-demo/node_modules/danger/distribution/runner/runners/inline.js:32:23)
at Object.next (/builds/unikitty37/danger-demo/node_modules/danger/distribution/runner/runners/inline.js:13:53)
at /builds/unikitty37/danger-demo/node_modules/danger/distribution/runner/runners/inline.js:7:71
at new Promise (<anonymous>)
at __awaiter (/builds/unikitty37/danger-demo/node_modules/danger/distribution/runner/runners/inline.js:3:12)
at Object.exports.runDangerfileEnvironment (/builds/unikitty37/danger-demo/node_modules/danger/distribution/runner/runners/inline.js:105:136)
Failing the build, there is 1 fail.
Feedback: https://gitlab.com/unikitty37/danger-demo/merge_requests/1#note_404292895
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
To Reproduce Steps to reproduce the behaviour:
- Fork https://gitlab.com/unikitty37/danger-demo, which uses the Dangerfile from https://danger.systems/js/guides/getting_started.html#creating-a-dangerfile
- Configure the DANGER_GITLAB_API_TOKEN variable in the CI settings
- Create an MR on the fork
Expected behaviour
The Dangerfile runs, and attaches a comment containing a list of the modified files.
Screenshots n/a
Your Environment
software | version |
---|---|
danger.js | 10.4.0 |
node | 14.5.0 |
yarn | 1.22.4 |
Operating System | Docker container node:14-alpine |
Additional context I’m not sure if Danger is transpiling correctly — vue-cli sets up projects with Babel by default, but https://danger.systems/js/tutorials/transpilation.html doesn’t really give me much of a clue on how to debug this…
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9 (3 by maintainers)
Top Results From Across the Web
node.js - Running into "couldn't infer parser" error using vue-cli
I'm not sure why, but I tried to downgrade to 1.2.1 using yarn , but it didn't seem to work. The thing that...
Read more >Vue.js | IntelliJ IDEA Documentation - JetBrains
js app is the create-vue official Vue project scaffolding tool, which IntelliJ IDEA downloads and runs for you using npx. You can still...
Read more >From vue-cli to vitejs - Medium
I recently migrated some Vue2 projects from vue-cli / webpack to vitejs. ... Now with vite, WebStorm doesn't know yet how to parse...
Read more >Modes and Environment Variables - Vue CLI
With NODE_ENV set to "test" for example, Vue CLI creates a webpack config that is intended to be used and optimized for unit...
Read more >How to Migrate from Vue CLI to Vite - Vue School Blog
The approach also means that Hot Module Replacement remains fast no matter the size of the application since the entire bundle doesn't have...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
While the issue is already being closed if anyone struggles with this issue just add the join polyfills in the babel.config.js. this will do the trick.
Same problem, similar setup (vue). Dind’t work either in CI or locally. I’ve tried to debug the source provided by @orta, but with no luck. However just changed dangerfile to typescript and everything works in CI as well as locally.