Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
feat: add `unplugin-auto-import@^0.17.3
Browse files Browse the repository at this point in the history
  • Loading branch information
bvanjoi committed Feb 19, 2024
1 parent b81e03a commit 745bbe7
Show file tree
Hide file tree
Showing 12 changed files with 943 additions and 305 deletions.
1 change: 1 addition & 0 deletions packages/babel-loader@9/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"devDependencies": {
"@rspack/cli": "0.3.11",
"babel-loader": "^9.1.3",
"@babel/core": "^7.23.9",
"@babel/preset-typescript": "^7.23.2"
},
"rspack": {
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-loader@9/rspack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = defineConfig({
},
experiments: {
rspackFuture: {
disableTransformByDefault:true
disableTransformByDefault: true
}
}
});;
4 changes: 4 additions & 0 deletions packages/babel-loader@9/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"compilerOptions": {},
"include": ["src"]
}
3 changes: 2 additions & 1 deletion packages/fork-ts-checker-webpack-plugin@8/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
},
"devDependencies": {
"@rspack/cli": "0.3.11",
"fork-ts-checker-webpack-plugin": "^8.0.0"
"fork-ts-checker-webpack-plugin": "^8.0.0",
"typescript": "^5.3.3"
},
"rspack": {
"version": ">=0.3.11"
Expand Down
2 changes: 1 addition & 1 deletion packages/fork-ts-checker-webpack-plugin@8/rspack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ module.exports = defineConfig({
disableTransformByDefault: true
}
}
});;
});
12 changes: 12 additions & 0 deletions packages/unplugin-auto-import@0.17.3/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vue</title>
</head>
<body>
<div id="app"></div>
</body>
</html>
19 changes: 19 additions & 0 deletions packages/unplugin-auto-import@0.17.3/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@rspack-compat/rspack-unplugin_1.6",
"scripts": {
"build": "rspack build"
},
"dependencies": {
"vue": "^3.4.19"
},
"devDependencies": {
"@rspack/cli": "0.4.1",
"@rspack/core": "0.4.1",
"unplugin-auto-import": "^0.17.3",
"html-webpack-plugin": "5.6.0",
"vue-loader": "^17.4.2"
},
"rspack": {
"version": ">=0.4.1"
}
}
29 changes: 29 additions & 0 deletions packages/unplugin-auto-import@0.17.3/rspack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const { defineConfig } = require('@rspack/cli')
const { VueLoaderPlugin } = require("vue-loader");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const AutoImport = require("unplugin-auto-import/rspack").default;

module.exports = defineConfig({
plugins: [
AutoImport({
imports: ["vue"],
}),
new VueLoaderPlugin(),
// the aims of `HtmlWebpackPlugin` is ensure
// `unplugin-auto-import` will not includes `index.html`
new HtmlWebpackPlugin({
template: "./index.html",
}),
],
module: {
rules: [
{
test: /\.vue$/,
loader: "vue-loader",
options: {
experimentalInlineMatchResource: true,
},
}
],
},
});
26 changes: 26 additions & 0 deletions packages/unplugin-auto-import@0.17.3/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<script setup>
import HelloWorld from "./HelloWorld.vue";
const title = ref("Rspack + Vue");
</script>

<template>
<HelloWorld :msg="title" />
</template>

<style scoped>
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.vue:hover {
filter: drop-shadow(0 0 2em #42b883aa);
}
</style>
37 changes: 37 additions & 0 deletions packages/unplugin-auto-import@0.17.3/src/HelloWorld.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<script setup>
import { ref } from "vue";
defineProps({
msg: {
type: String,
}
})
const count = ref(0);
</script>

<template>
<h1>{{ msg }}</h1>

<div class="card">
<button type="button" @click="count++">count is {{ count }}</button>
<p>
Edit
<code>HelloWorld.vue</code> to test HMR
</p>
</div>

<p>
Check out Rspack which support Vue
</p>
<p>
Install
<a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
in your IDE for a better DX
</p>
</template>

<style scoped>
.read-the-docs {
color: #888;
}
</style>
4 changes: 4 additions & 0 deletions packages/unplugin-auto-import@0.17.3/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { createApp } from "vue";
import App from "./App.vue";

createApp(App).mount("#app");
Loading

0 comments on commit 745bbe7

Please sign in to comment.