Skip to content

Commit

Permalink
feat(plugin-vue): use Rslib to bundle (#3697)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Oct 12, 2024
1 parent bc954d8 commit 27f8e98
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
3 changes: 0 additions & 3 deletions packages/plugin-vue/modern.config.ts

This file was deleted.

11 changes: 5 additions & 6 deletions packages/plugin-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,19 @@
"type": "module",
"exports": {
".": {
"types": "./dist-types/index.d.ts",
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"main": "./dist/index.cjs",
"types": "./dist-types/index.d.ts",
"types": "./dist/index.d.ts",
"files": [
"dist",
"dist-types"
"dist"
],
"scripts": {
"build": "modern build",
"dev": "modern build --watch"
"build": "rslib build",
"dev": "rslib build --watch"
},
"dependencies": {
"vue-loader": "^17.4.2",
Expand Down
3 changes: 3 additions & 0 deletions packages/plugin-vue/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { dualPackage } from '@rsbuild/config/rslib.config.ts';

export default dualPackage;
5 changes: 4 additions & 1 deletion packages/plugin-vue/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { createRequire } from 'node:module';
import type { EnvironmentConfig, RsbuildPlugin } from '@rsbuild/core';
import { type VueLoaderOptions, VueLoaderPlugin } from 'vue-loader';
import { applySplitChunksRule } from './splitChunks';
import { applySplitChunksRule } from './splitChunks.js';

const require = createRequire(import.meta.url);

export type SplitVueChunkOptions = {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-vue/src/splitChunks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { CacheGroups, RsbuildPluginAPI, SplitChunks } from '@rsbuild/core';
import type { SplitVueChunkOptions } from '.';
import type { SplitVueChunkOptions } from './index.js';

const isPlainObject = (obj: unknown): obj is Record<string, any> =>
obj !== null &&
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-vue/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@rsbuild/config/tsconfig",
"extends": "@rsbuild/config/tsconfig-node16",
"compilerOptions": {
"outDir": "./dist",
"baseUrl": "./",
Expand Down

0 comments on commit 27f8e98

Please sign in to comment.