Open iassasin opened 3 years ago
Ensure that the rollup-plugin-vue
plugin is run before @rollup/plugin-typescript
.
@Smashman, if use this order of plugins, then error changes:
plugins: [
alias({
resolve: [ '.js', '.ts' ],
entries: [
{ find: 'vue', replacement: 'node_modules/vue/dist/vue.runtime.esm-browser.js' }
]
}),
resolve(),
Vue({ preprocessStyles: true }),
typescript(),
css({ output: 'dist/app.css' }),
],
Error:
Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
at error (.../vue3-rollup-bug/node_modules/rollup/dist/shared/rollup.js:5215:30)
Looks like typescript doesn't recognized at all.
Btw, see issue in typescript plugin (https://github.com/rollup/plugins/issues/608), maybe this issue doesn't related to rollup-plugin-vue, because with rollup-plugin-typescript2 config from my reproduction works great.
@iassasin I had the same issue, switching from @rollup/plugin-typescript
to rollup-plugin-typescript2
fixed it.
@kris-ellery, yes, I use this workaround too, but it's strange if it shouldn't work with official ts plugin.
it's strange if it shouldn't work with official ts plugin.
Agree with that, I waste 15 minutes on the official plugin before finding out the example is using rollup-plugin-typescript2
I think its a bug in the "official plugin" (see https://github.com/rollup/plugins/issues/608).
Version
6.0.0-beta10
Reproduction link
https://github.com/iassasin/vue3-rollup-ts-bug
Steps to reproduce
Clone example repository and
npm run build
.What is expected?
working bundle
What is actually happening?
What I did wrong? Looks like rollup-plugin-vue bug.