-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed
Description
What problem does this feature solve?
vue-template-compiler
runs a version check against the vue
specifier Node.js resolves as soon as it's imported here.
Because of this:
- I'm getting a vue-loader recommendation in a rollup build
- I can't have a setup that builds to both Vue 2 and 3. I think it's important to support this use-case for the eco-system as more apps migrate to Vue 3.
I'm interested in building a component to both Vue 2 and 3, but the version mismatch error from above gets thrown as soon as rollup-plugin-vue@5
is imported.
My package.json
looks like this:
{
...,
"devDependencies": {
"@vue/compiler-sfc": "^3.0.4",
"rollup": "^2.35.1",
"rollup-plugin-vue2": "npm:rollup-plugin-vue@^5.1.9",
"rollup-plugin-vue3": "npm:rollup-plugin-vue@^6.0.0",
"vue": "^3.0.4",
"vue-template-compiler": "^2.6.12",
"vue2": "npm:vue@^2.6.12"
}
}
My rollup.config.js
looks like this:
import vue2 from 'rollup-plugin-vue2';
import vue3 from 'rollup-plugin-vue3';
const rollupConfig = [
{
input: 'src/MyComponent.vue',
plugins: [
vue3(),
],
output: {
format: 'es',
file: 'dist/my-component.vue3.esm.js',
},
},
{
input: 'src/MyComponent.vue',
plugins: [
vue2(),
],
output: {
format: 'es',
file: 'dist/my-component.vue2.esm.js',
},
},
];
export default rollupConfig;
What does the proposed API look like?
Wondering if this can be changed to a run-time check or moved to the appropriate loader/plugin.
A run-time check might be a good idea as I'm sure a lot of people may be accidentally trying to import Vue 2 components into a Vue 3 app and vice-versa.
pawelgurgniuslab and CrabSAMA
Metadata
Metadata
Assignees
Labels
No labels