Skip to content

Adjust documentation for using @vue/babel-preset-app in a non vue-cli environment #1725

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

Closed
ChristianStornowski opened this issue Jul 1, 2018 · 9 comments

Comments

@ChristianStornowski
Copy link

What problem does this feature solve?

Using ts-jest, babel, @vue/babel-preset-app and @babel/preset-typescript" together, causes tests failures even when setting typescript compiler option "module" to "commonjs" and "allowSyntheticDefaultImports" to "true".

.babelrc

{
  "presets": [
    "@vue/app",
    "@babel/preset-typescript"
  ]
}

What does the proposed API look like?

Documentation of setting environment variables before running ts-jest.

VUE_CLI_BABEL_TARGET_NODE = true
VUE_CLI_BABEL_TRANSPILE_MODULES = true
VUE_CLI_BUILD_TARGET = app
@LinusBorg LinusBorg added the needs reproduction This issue is missing a minimal runnable reproduction, provided by the author label Jul 2, 2018
@LinusBorg
Copy link
Member

I'm not sure that I can reproduce a project with the behaviouir you are seeing

  • which options did you choose when installing?
  • What changes, if any, did you make to the clean project?
  • What command did you run?
  • What error did you recieve?

@ChristianStornowski
Copy link
Author

I created this online project: https://codesandbox.io/s/7w5qrwpxnq

npm test will failure with

import "core-js/modules/es6.promise";
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

SyntaxError: Unexpected string

npm run test:working is going to be fine. (maybe you have to delete jest tmp folder first (Linux: /tmp/jest_rs/).

@LinusBorg
Copy link
Member

Oh, now i get it. Should have read your title more carefully.

So you are using the babel preset in an app not created with vue-cli, and had to dig into the yource to learn that you have to set some ENV variables to make it work the way you expect it to.

And your request would be that these env variables are documented in that preset's README.

Seems sensilbe. :)

@LinusBorg LinusBorg removed the needs reproduction This issue is missing a minimal runnable reproduction, provided by the author label Jul 2, 2018
@pikax

This comment has been minimized.

@LinusBorg

This comment has been minimized.

@yyx990803
Copy link
Member

@vue/babel-preset-app is specifically designed to use with projects created via Vue CLI. It does not consider uses cases outside of Vue CLI. We can make this more explicit in its README.

@victor71
Copy link

@vue/babel-preset-app is specifically designed to use with projects created via Vue CLI. It does not consider uses cases outside of Vue CLI. We can make this more explicit in its README.

How to determine core-js3 in @vue/babel-preset-app? I add the 'corejs' option to preset '@vue/app', but it now work.

@haoqunjiang
Copy link
Member

@victor71, For now, use @vue/babel-preset-app v4.0.0-alpha.0. It's too much work for us to keep compatibility with both core-js versions, so we only bump the version in a new major release.

@victor71
Copy link

@sodatea Thank you!

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

No branches or pull requests

7 participants