Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

Broken Vue 3 typescript #400

Open
iassasin opened this issue Oct 13, 2020 · 6 comments
Open

Broken Vue 3 typescript #400

iassasin opened this issue Oct 13, 2020 · 6 comments
Milestone

Comments

@iassasin
Copy link

iassasin commented Oct 13, 2020

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?

[!] (plugin typescript) Error: Could not load .../MainView.vue?vue&type=script&lang.ts (imported by MainView.vue): Debug Failure. False expression: Expected fileName to be present in command line

What I did wrong? Looks like rollup-plugin-vue bug.

@Smashman
Copy link

Ensure that the rollup-plugin-vue plugin is run before @rollup/plugin-typescript.

@iassasin
Copy link
Author

@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 (rollup/plugins#608), maybe this issue doesn't related to rollup-plugin-vue, because with rollup-plugin-typescript2 config from my reproduction works great.

@kris-ellery
Copy link

@iassasin I had the same issue, switching from @rollup/plugin-typescript to rollup-plugin-typescript2 fixed it.

@iassasin
Copy link
Author

@kris-ellery, yes, I use this workaround too, but it's strange if it shouldn't work with official ts plugin.

@Mister-Hope
Copy link

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

@mnlipp
Copy link

mnlipp commented Feb 28, 2021

I think its a bug in the "official plugin" (see rollup/plugins#608).

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

No branches or pull requests

6 participants