-
-
Notifications
You must be signed in to change notification settings - Fork 148
Vue 3 compatibility #322
Comments
Vue 3 support is work in progress. Check https://github.com/vuejs/rollup-plugin-vue/tree/next |
I had a small look. |
Yes, please. |
Forgot the most important part: |
Squashed commit of the following: commit 78dd9524df9bb5aea6c019091d123d80b22d9be3 Author: Liang Zhou <[email protected]> Date: Tue Mar 31 23:33:34 2020 -0500 Update docs. commit 19924d92a954e6e70877c43663601e1583b9662c Author: Liang Zhou <[email protected]> Date: Tue Mar 31 23:17:26 2020 -0500 Finish up first revision. commit 3699508dc5b54643b33aba91a969ae64ef2f9c4d Author: Liang Zhou <[email protected]> Date: Sun Mar 29 22:49:16 2020 -0500 Adjust path. commit dda8c4518eb250871158cfaaa7a8e54c2813b21c Author: Liang Zhou <[email protected]> Date: Sun Mar 29 21:52:13 2020 -0500 Add sass/css/style loaders. commit 9b79ba78da70a77125598e29aef06844ebcaeb00 Author: Liang Zhou <[email protected]> Date: Sun Mar 29 16:44:33 2020 -0500 add sass loader according to error. ERROR in ./src/components/TestComponent.vue?vue&type=style&index=0&id=5bfff48d&lang=sass&scoped=true (./node_modules/vue-loader/dist??ref--6-0!./src/components/TestComponent.vue?vue&type=style&index=0&id=5bfff48d&lang=sass&scoped=true) 2:2 Module parse failed: Unexpected token (2:2) File was processed with these loaders: * ./node_modules/vue-loader/dist/index.js You may need an additional loader to handle the result of these loaders. | > .test-class | background: red commit dc0789a8e5e4f5043e2a1a60b46a17af4b131a93 Author: Liang Zhou <[email protected]> Date: Sun Mar 29 16:19:32 2020 -0500 Add VueLoaderPlugin according to error in the build. ERROR in ./src/components/TestComponent.vue Module Error (from ./node_modules/vue-loader/dist/index.js): vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config. @ ./src/index.js 3:0-58 5:0-24 commit 29c2d447c1282de5b1494e9430e46955c0cc5559 Author: Liang Zhou <[email protected]> Date: Sun Mar 29 16:16:43 2020 -0500 Add vue/compiler-sfc according to error in the build. ERROR in ./src/components/TestComponent.vue Module build failed (from ./node_modules/vue-loader/dist/index.js): Error: vue-loader requires @vue/compiler-sfc to be present in the dependency tree. commit 659eded9b0884e846e17b43477d536e91f2d11bd Author: Liang Zhou <[email protected]> Date: Sun Mar 29 16:04:11 2020 -0500 add vue loader commit 232d393d233dd91a7c61a7c982992b9b7ef013d2 Author: Liang Zhou <[email protected]> Date: Sun Mar 29 15:40:20 2020 -0500 add webpack. commit 0664ff4ff5be67b822e65333352e6f93858ef958 Author: Liang Zhou <[email protected]> Date: Sun Mar 29 14:39:54 2020 -0500 Add vue 3 as dev dependency. commit d07d78eb525a08c2e4067c4e12c7be99d6520808 Author: Liang Zhou <[email protected]> Date: Fri Mar 27 01:47:28 2020 -0500 delete rollup. commit 8378c640df8e2d3e3bd95fcaacecc7d3d4fbae76 Author: Liang Zhou <[email protected]> Date: Fri Mar 27 01:43:43 2020 -0500 rollup wip. Not working yet See: vuejs/rollup-plugin-vue#322. Run into the following error: ➜ vue-material-components git:(basic-build) ✗ yarn build yarn run v1.22.4 $ rollup -c --environment BUILD:production [!] Error: Cannot find module 'vue-template-compiler' Require stack: - vue-material-components/node_modules/@vue/component-compiler/dist/compiler.js - vue-material-components/node_modules/@vue/component-compiler/dist/index.js - vue-material-components/node_modules/rollup-plugin-vue/dist/rollup-plugin-vue.js - vue-material-components/rollup.config.js - vue-material-components/node_modules/rollup/dist/bin/rollup commit f45b1dd7c05b2a762ef7158529e81518d381e295 Author: Liang Zhou <[email protected]> Date: Fri Mar 27 00:58:55 2020 -0500 Add rollup plugin vue as dev dependency. commit e2a3dc7c2ecd2f46464a24a1fffc6aea692e0a63 Author: Liang Zhou <[email protected]> Date: Fri Mar 27 00:53:45 2020 -0500 Add rollup dev dependency. commit 4bd21bd6d4801017fed099142c15299e1fe3a386 Author: Liang Zhou <[email protected]> Date: Fri Mar 27 00:47:36 2020 -0500 set up test files.
Try new alpha version: |
Will do! Am in a project right now, but I think next weekend I'll manage. |
version |
Just posting to inform. Using Following error occurs:
//rollup.config.js
import vue from 'rollup-plugin-vue' // v6.0.0-alpha.8
import typescript from '@rollup/plugin-typescript' // v7.9.0
import resolve from '@rollup/plugin-node-resolve'; // v7.1.3
export default {
input: 'src/index.ts',
output: {
format: 'umd',
file: 'dist/bundle.js'
},
plugins: [
vue({}),
typescript(),
resolve(),
]
} //tsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"moduleResolution": "node",
"target": "es2015",
"paths": {
"vue": ["@vue/runtime-dom"]
}
},
"exclude": [
"./node_modules"
],
"include": [
"**/*.ts",
"**/*.vue"
]
} //Test.vue
<template>
<h1>Hello {{ name }}</h1>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
export default defineComponent({
props: {
name: {
type: String as () => string
}
}
})
</script>
<style scoped>
</style> //index.ts
import Test from "./Test.vue";
import { createApp } from "vue";
createApp(Test).mount(document.body) |
Works much better now, didn't have that much time to test, but the things I mentioned work smoothly now (tried some scoped scss with some other non-scoped). |
[FYI] |
@ushironoko can u share snippet of configuration ? |
You can use with rollup-plugin-typescript2 already includes the correct filter. P.S. Please send PR to |
@ayZagen There is no special setting. Just use rollup-plugin-typescript2. However, looking at the comments, it doesn't seem to be necessary to use it.
|
@ushironoko I think you're using 2.x compatible version of rollup-plugin-vue. In current |
@znck That's right. This snippet uses @ vue / composition-api. I didn't know that it doesn't work on Vue3. Thanks for pointing out. |
Hey guys. I am testing this plugin on a lib I am developing. I understand it is still WIP, but I'd like to know If i could as for a little help, just to understand if it is something that was not yet addressed, or if i am doing something wrong. I am using vue3 + class components do develop the lib. If i compile my components without the this is the error I am getting: https://imghub.io/i/NoO0e this is my
and this is the component (template ommited)
thanks! |
Usually you shouldn't need the sass rollup plugin. Have you installed the regular "sass" package in your project? |
Ok after hours I have finally found a rollup config that works for me with vue3. Little addition. I am using pug so if you don't you may skip that one. Wanted to include it though because if you are using pug it will fail without the plugin. A little strange since I didn't need it in vue2 but rollup seems to be sorcery anyways 🧙. Now my tsconfig might contain some unnecessary stuff. It's more or less what I found suiting for alot of my projects, so feel free to clear out what you don't want ;) versions "vue": "^3.0.0"
"@rollup/plugin-commonjs": "^17.1.0",
"@rollup/plugin-node-resolve": "^11.2.0",
"rollup": "^2.40.0",
"rollup-plugin-css-only": "^3.1.0",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-pug": "^1.1.1",
"rollup-plugin-typescript2": "^0.30.0",
"rollup-plugin-vue": "^6.0.0-beta.10", rollup.config.js import peerDepsExternal from 'rollup-plugin-peer-deps-external';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import typescript from 'rollup-plugin-typescript2';
import vue from 'rollup-plugin-vue';
import css from "rollup-plugin-css-only";
import pug from "rollup-plugin-pug"
import packageJson from './package.json';
export default {
input: 'src/index.ts',
output: [
{
format: 'cjs',
file: packageJson.main,
sourcemap: true
},
{
format: 'esm',
file: packageJson.module,
sourcemap: true
}
],
plugins: [
peerDepsExternal(),
resolve(),
commonjs(),
pug(),
css(),
vue(),
typescript({ tsconfig: 'tsconfig.json' }),
]
}; tsconfig.json {
"compilerOptions": {
"declarationDir": "lib",
"declaration": true,
"rootDir": "src",
"target": "es5",
"module": "es6",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "Node",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"baseUrl": ".",
"types": [
"webpack-env",
"mocha",
"chai",
],
"typeRoots": [
"./node_modules/@types",
"./src/types",
],
"paths": {
"@/*": [
"src/*"
],
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
],
"exclude": [
"node_modules/**",
"tests/**"
]
} package.json //...
"scripts": {
"build": "rm -rf lib/ && rollup -c",
},
"main": "lib/index.js",
"module": "lib/index.esm.js",
"es2015": "lib/index.js",
//... |
I am trying to use it with version
The arrow is pointing at my v-if. Does anybody know why this is happening? |
@jessielaf I got rid of that issue by moving |
What problem does this feature solve?
Test rollup in https://github.com/vuejs/vue-next-webpack-preview -project.
Shows error from src/utils.ts: "File not processed yet".
What does the proposed API look like?
Same, in a new branch.
The text was updated successfully, but these errors were encountered: