Skip to content

Commit

Permalink
feat(plugin-svelte): use Rslib to bundle (#3705)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Oct 13, 2024
1 parent c890651 commit 2ce1584
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 47 deletions.
35 changes: 0 additions & 35 deletions packages/plugin-svelte/modern.config.ts

This file was deleted.

11 changes: 5 additions & 6 deletions packages/plugin-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,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": {
"svelte-loader": "3.2.4",
Expand Down
3 changes: 3 additions & 0 deletions packages/plugin-svelte/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;
6 changes: 1 addition & 5 deletions packages/plugin-svelte/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { promises } from 'node:fs';
import path from 'node:path';
import { logger } from '@rsbuild/core';
import type { RsbuildPlugin } from '@rsbuild/core';
import type { sveltePreprocess } from 'svelte-preprocess';
import { sveltePreprocess } from 'svelte-preprocess';
import type { CompileOptions } from 'svelte/compiler';

export type AutoPreprocessOptions = NonNullable<
Expand Down Expand Up @@ -73,10 +73,6 @@ export function pluginSvelte(options: PluginSvelteOptions = {}): RsbuildPlugin {

api.modifyBundlerChain(
async (chain, { CHAIN_ID, environment, isDev, isProd }) => {
const { default: sveltePreprocess } = await import(
'svelte-preprocess'
);

const svelte5 = await isSvelte5(sveltePath);

const environmentConfig = environment.config;
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-svelte/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 2ce1584

Please sign in to comment.