Skip to content

Commit c481f8d

Browse files
authored
feat!: remove default plugin export (#70)
1 parent 20c3be2 commit c481f8d

14 files changed

Lines changed: 29 additions & 54 deletions

File tree

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ The enabling of the [Preact Refresh](https://github.com/preactjs/prefresh) is di
3737
3838
```js
3939
import { createRequire } from 'node:module';
40-
import PreactRefreshPlugin from '@rspack/plugin-preact-refresh';
40+
import { PreactRefreshRspackPlugin } from '@rspack/plugin-preact-refresh';
4141

4242
const require = createRequire(import.meta.url);
4343
const isDev = process.env.NODE_ENV === 'development';
@@ -82,7 +82,7 @@ export default {
8282
},
8383
],
8484
},
85-
plugins: [isDev && new PreactRefreshPlugin()].filter(Boolean),
85+
plugins: [isDev && new PreactRefreshRspackPlugin()].filter(Boolean),
8686
};
8787
```
8888
@@ -96,7 +96,7 @@ export default {
9696
Include files to be processed by the plugin. The value is the same as the `rule.test` option in Rspack.
9797
9898
```js
99-
new PreactRefreshPlugin({
99+
new PreactRefreshRspackPlugin({
100100
include: [/\.jsx$/, /\.tsx$/],
101101
});
102102
```
@@ -109,7 +109,7 @@ new PreactRefreshPlugin({
109109
Exclude files from being processed by the plugin. The value is the same as the `rule.exclude` option in Rspack.
110110
111111
```js
112-
new PreactRefreshPlugin({
112+
new PreactRefreshRspackPlugin({
113113
exclude: [/node_modules/, /some-other-module/],
114114
});
115115
```
@@ -127,7 +127,7 @@ import { createRequire } from 'node:module';
127127

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

130-
new PreactRefreshPlugin({
130+
new PreactRefreshRspackPlugin({
131131
preactPath: path.dirname(require.resolve('preact/package.json')),
132132
});
133133
```

src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,3 @@ class PreactRefreshRspackPlugin implements RspackPluginInstance {
143143
}
144144

145145
export { PreactRefreshRspackPlugin };
146-
export default PreactRefreshRspackPlugin;

test/configCases/condition/exclude/rspack.config.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
const {
2-
default: ReactRefreshRspackPlugin,
3-
} = require('../../../../dist/index.js');
1+
const { PreactRefreshRspackPlugin } = require('../../../../dist/index.js');
42

53
/** @type {import('@rspack/core').Configuration} */
64
module.exports = {
@@ -9,7 +7,7 @@ module.exports = {
97
context: __dirname,
108
entry: './index.js',
119
plugins: [
12-
new ReactRefreshRspackPlugin({
10+
new PreactRefreshRspackPlugin({
1311
exclude: /file\.js/,
1412
}),
1513
],

test/configCases/condition/include/rspack.config.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
const {
2-
default: ReactRefreshRspackPlugin,
3-
} = require('../../../../dist/index.js');
1+
const { PreactRefreshRspackPlugin } = require('../../../../dist/index.js');
42

53
/** @type {import('@rspack/core').Configuration} */
64
module.exports = {
@@ -9,7 +7,7 @@ module.exports = {
97
context: __dirname,
108
entry: './index.js',
119
plugins: [
12-
new ReactRefreshRspackPlugin({
10+
new PreactRefreshRspackPlugin({
1311
exclude: /$^/, // match nothing
1412
include: /foo/,
1513
}),

test/hotCases/hook/useContext_initial/rspack.config.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
const {
2-
default: ReactRefreshRspackPlugin,
3-
} = require('../../../../dist/index.js');
1+
const { PreactRefreshRspackPlugin } = require('../../../../dist/index.js');
42

53
/** @type {import('@rspack/core').Configuration} */
64
module.exports = {
@@ -56,5 +54,5 @@ module.exports = {
5654
},
5755
],
5856
},
59-
plugins: [new ReactRefreshRspackPlugin()],
57+
plugins: [new PreactRefreshRspackPlugin()],
6058
};

test/hotCases/hook/useContext_keep/rspack.config.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
const {
2-
default: ReactRefreshRspackPlugin,
3-
} = require('../../../../dist/index.js');
1+
const { PreactRefreshRspackPlugin } = require('../../../../dist/index.js');
42

53
/** @type {import('@rspack/core').Configuration} */
64
module.exports = {
@@ -56,5 +54,5 @@ module.exports = {
5654
},
5755
],
5856
},
59-
plugins: [new ReactRefreshRspackPlugin()],
57+
plugins: [new PreactRefreshRspackPlugin()],
6058
};

test/hotCases/hook/useContext_provide/rspack.config.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
const {
2-
default: ReactRefreshRspackPlugin,
3-
} = require('../../../../dist/index.js');
1+
const { PreactRefreshRspackPlugin } = require('../../../../dist/index.js');
42

53
/** @type {import('@rspack/core').Configuration} */
64
module.exports = {
@@ -56,5 +54,5 @@ module.exports = {
5654
},
5755
],
5856
},
59-
plugins: [new ReactRefreshRspackPlugin()],
57+
plugins: [new PreactRefreshRspackPlugin()],
6058
};

test/hotCases/hook/useState_keep/rspack.config.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
const {
2-
default: ReactRefreshRspackPlugin,
3-
} = require('../../../../dist/index.js');
1+
const { PreactRefreshRspackPlugin } = require('../../../../dist/index.js');
42

53
/** @type {import('@rspack/core').Configuration} */
64
module.exports = {
@@ -56,5 +54,5 @@ module.exports = {
5654
},
5755
],
5856
},
59-
plugins: [new ReactRefreshRspackPlugin()],
57+
plugins: [new PreactRefreshRspackPlugin()],
6058
};

test/hotCases/hook/useState_reset/rspack.config.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
const {
2-
default: ReactRefreshRspackPlugin,
3-
} = require('../../../../dist/index.js');
1+
const { PreactRefreshRspackPlugin } = require('../../../../dist/index.js');
42

53
/** @type {import('@rspack/core').Configuration} */
64
module.exports = {
@@ -56,5 +54,5 @@ module.exports = {
5654
},
5755
],
5856
},
59-
plugins: [new ReactRefreshRspackPlugin()],
57+
plugins: [new PreactRefreshRspackPlugin()],
6058
};

test/hotCases/jsx/basic/rspack.config.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
const {
2-
default: ReactRefreshRspackPlugin,
3-
} = require('../../../../dist/index.js');
1+
const { PreactRefreshRspackPlugin } = require('../../../../dist/index.js');
42

53
/** @type {import('@rspack/core').Configuration} */
64
module.exports = {
@@ -55,5 +53,5 @@ module.exports = {
5553
},
5654
],
5755
},
58-
plugins: [new ReactRefreshRspackPlugin()],
56+
plugins: [new PreactRefreshRspackPlugin()],
5957
};

0 commit comments

Comments
 (0)