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

--modern flag ignored when using typescript #3205 #3206

Closed
jestarray opened this issue Dec 28, 2018 · 3 comments · Fixed by #4046
Closed

--modern flag ignored when using typescript #3205 #3206

jestarray opened this issue Dec 28, 2018 · 3 comments · Fixed by #4046

Comments

@jestarray
Copy link

Version

3.2.1

Environment info

Environment Info:

  System:
    OS: Windows 10
    CPU: (12) x64 AMD Ryzen 5 1600 Six-Core Processor
  Binaries:
    Node: Not Found
    Yarn: Not Found
    npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Not Found
  npmPackages:
    @vue/cli-overlay:  3.2.0
    @vue/cli-plugin-typescript: ^3.2.0 => 3.2.0
    @vue/cli-service: ^3.2.0 => 3.2.0
    @vue/cli-shared-utils:  3.2.0
    @vue/component-compiler-utils:  2.3.1
    @vue/preload-webpack-plugin:  1.1.0
    @vue/web-component-wrapper:  1.2.0
    vue: ^2.5.17 => 2.5.21
    vue-class-component: ^6.0.0 => 6.3.2
    vue-hot-reload-api:  2.3.1
    vue-loader:  15.4.2
    vue-property-decorator: ^7.0.0 => 7.2.0
    vue-router: ^3.0.1 => 3.0.2
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.5.17 => 2.5.21
    vue-template-es2015-compiler:  1.6.0
    vuex: ^3.0.1 => 3.0.1
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

vue-cli-service build --modern

What is expected?

It should compile to ES2015

What is actually happening?

It doesn't compile to ES2015 because you have to modify the .tsconfig target.


The target option in tsconfig is absolute, meaning if target: es2018 or if target:es2015, all code will be transpiled to said target in tsconfig regardless of --modern flag being used or not. This should be reflected in the docs or warn when using typescript.

@LinusBorg
Copy link
Member

We should probably mention that modern mode requires Babel, yeah.

@LinusBorg
Copy link
Member

So I checked the docs and the section about modern mode starts with:

With Babel we are able to leverage all the newest language features in ES2015+, but that also means we have to ship transpiled and polyfilled bundles in order to support older browsers.

So the information is already there, but maybe it's not prominent enough.

I'm thinking rather than adding another :::tip to that docs section, maybe we should augment the prompts messages for TS? Currently, we ask this when installing typescript:

Use Babel alongside TypeScript for auto-detected polyfills?

We could extend it like this:

Use Babel alongside TypeScript (required for Modern Mode, auto-detected polyfills, transpiling JSX?

@jestarray
Copy link
Author

Ahh, I must've missed that, my bad. On that note, even without babel installed, the modern and legacy bundles are still generated and they both are legacy without warning iirc.

I personally don't need the legacy support for older browsers so I don't want or need babel at all. Typescript can transpile to older versions of ecmascript too, so I thought --modern would work without babel. I think that's good, makes it more explicit that babel is a hard dependency needed for --modern.

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

Successfully merging a pull request may close this issue.

3 participants