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

Transpile template using babel #260

Merged
merged 3 commits into from
Aug 1, 2020
Merged

Transpile template using babel #260

merged 3 commits into from
Aug 1, 2020

Conversation

lmiller1990
Copy link
Member

@lmiller1990 lmiller1990 commented Jul 29, 2020

The new @vue/compiler-sfc generates code using ES module syntax. It is causing some problems with vue-cli: vuejs/vue-cli#5714 (comment)

Easy fix is just use babel to compile the template code to commonjs module syntax. The idea for v5 was to be entirely ts-jest based, although even if I set target: es5 etc in tsconfig.json I could not get it to work. This seems like the best solution, so people can use VTU and vue-jest with vue-cli out of the box.

Testing

I tested this in a pretty primitive manner: create a new cli project:

Vue CLI v4.5.0
? Please pick a preset: Manually select features
? Check the features needed for your project: Choose Vue version, Babel, TS, Unit
? Choose a version of Vue.js that you want to start the project with 3.x (Preview)
? Use class-style component syntax? No
? Use Babel alongside TypeScript (required for modern mode, auto-detected polyfills, t
ranspiling JSX)? Yes
? Pick a unit testing solution: Jest
? Where do you prefer placing config for Babel, ESLint, etc.? In dedicated config file
s

Note I included babel and TypeScript and testing with jest.

Then yarn test:unit --no-cache and it failed. Then I just copy and pasted the new vue-jest from the PR into node_modules and ran yarn test:unit --no-cache and it passed. As long as CI passes, we should be good.

resolves #258

@lmiller1990
Copy link
Member Author

It's out

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

Successfully merging this pull request may close these issues.

1 participant