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

Broken Vue 3 typescript #400

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

Broken Vue 3 typescript #400

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

Comments

@iassasin
Copy link

@iassasin 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

@Smashman Smashman commented Oct 23, 2020

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

@iassasin
Copy link
Author

@iassasin iassasin commented Oct 24, 2020

@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

@kris-ellery kris-ellery commented Nov 24, 2020

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

@iassasin
Copy link
Author

@iassasin iassasin commented Nov 25, 2020

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

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

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.