Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The enabling of the [Preact Refresh](https://github.com/preactjs/prefresh) is di

```js
import { createRequire } from 'node:module';
import PreactRefreshPlugin from '@rspack/plugin-preact-refresh';
import { PreactRefreshRspackPlugin } from '@rspack/plugin-preact-refresh';

const require = createRequire(import.meta.url);
const isDev = process.env.NODE_ENV === 'development';
Expand Down Expand Up @@ -82,7 +82,7 @@ export default {
},
],
},
plugins: [isDev && new PreactRefreshPlugin()].filter(Boolean),
plugins: [isDev && new PreactRefreshRspackPlugin()].filter(Boolean),
};
```

Expand All @@ -96,7 +96,7 @@ export default {
Include files to be processed by the plugin. The value is the same as the `rule.test` option in Rspack.

```js
new PreactRefreshPlugin({
new PreactRefreshRspackPlugin({
include: [/\.jsx$/, /\.tsx$/],
});
```
Expand All @@ -109,7 +109,7 @@ new PreactRefreshPlugin({
Exclude files from being processed by the plugin. The value is the same as the `rule.exclude` option in Rspack.

```js
new PreactRefreshPlugin({
new PreactRefreshRspackPlugin({
exclude: [/node_modules/, /some-other-module/],
});
```
Expand All @@ -127,7 +127,7 @@ import { createRequire } from 'node:module';

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

new PreactRefreshPlugin({
new PreactRefreshRspackPlugin({
preactPath: path.dirname(require.resolve('preact/package.json')),
});
```
Expand Down
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,3 @@ class PreactRefreshRspackPlugin implements RspackPluginInstance {
}

export { PreactRefreshRspackPlugin };
export default PreactRefreshRspackPlugin;
6 changes: 2 additions & 4 deletions test/configCases/condition/exclude/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const {
default: ReactRefreshRspackPlugin,
} = require('../../../../dist/index.js');
const { PreactRefreshRspackPlugin } = require('../../../../dist/index.js');

/** @type {import('@rspack/core').Configuration} */
module.exports = {
Expand All @@ -9,7 +7,7 @@ module.exports = {
context: __dirname,
entry: './index.js',
plugins: [
new ReactRefreshRspackPlugin({
new PreactRefreshRspackPlugin({
exclude: /file\.js/,
}),
],
Expand Down
6 changes: 2 additions & 4 deletions test/configCases/condition/include/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const {
default: ReactRefreshRspackPlugin,
} = require('../../../../dist/index.js');
const { PreactRefreshRspackPlugin } = require('../../../../dist/index.js');

/** @type {import('@rspack/core').Configuration} */
module.exports = {
Expand All @@ -9,7 +7,7 @@ module.exports = {
context: __dirname,
entry: './index.js',
plugins: [
new ReactRefreshRspackPlugin({
new PreactRefreshRspackPlugin({
exclude: /$^/, // match nothing
include: /foo/,
}),
Expand Down
6 changes: 2 additions & 4 deletions test/hotCases/hook/useContext_initial/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const {
default: ReactRefreshRspackPlugin,
} = require('../../../../dist/index.js');
const { PreactRefreshRspackPlugin } = require('../../../../dist/index.js');

/** @type {import('@rspack/core').Configuration} */
module.exports = {
Expand Down Expand Up @@ -56,5 +54,5 @@ module.exports = {
},
],
},
plugins: [new ReactRefreshRspackPlugin()],
plugins: [new PreactRefreshRspackPlugin()],
};
6 changes: 2 additions & 4 deletions test/hotCases/hook/useContext_keep/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const {
default: ReactRefreshRspackPlugin,
} = require('../../../../dist/index.js');
const { PreactRefreshRspackPlugin } = require('../../../../dist/index.js');

/** @type {import('@rspack/core').Configuration} */
module.exports = {
Expand Down Expand Up @@ -56,5 +54,5 @@ module.exports = {
},
],
},
plugins: [new ReactRefreshRspackPlugin()],
plugins: [new PreactRefreshRspackPlugin()],
};
6 changes: 2 additions & 4 deletions test/hotCases/hook/useContext_provide/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const {
default: ReactRefreshRspackPlugin,
} = require('../../../../dist/index.js');
const { PreactRefreshRspackPlugin } = require('../../../../dist/index.js');

/** @type {import('@rspack/core').Configuration} */
module.exports = {
Expand Down Expand Up @@ -56,5 +54,5 @@ module.exports = {
},
],
},
plugins: [new ReactRefreshRspackPlugin()],
plugins: [new PreactRefreshRspackPlugin()],
};
6 changes: 2 additions & 4 deletions test/hotCases/hook/useState_keep/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const {
default: ReactRefreshRspackPlugin,
} = require('../../../../dist/index.js');
const { PreactRefreshRspackPlugin } = require('../../../../dist/index.js');

/** @type {import('@rspack/core').Configuration} */
module.exports = {
Expand Down Expand Up @@ -56,5 +54,5 @@ module.exports = {
},
],
},
plugins: [new ReactRefreshRspackPlugin()],
plugins: [new PreactRefreshRspackPlugin()],
};
6 changes: 2 additions & 4 deletions test/hotCases/hook/useState_reset/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const {
default: ReactRefreshRspackPlugin,
} = require('../../../../dist/index.js');
const { PreactRefreshRspackPlugin } = require('../../../../dist/index.js');

/** @type {import('@rspack/core').Configuration} */
module.exports = {
Expand Down Expand Up @@ -56,5 +54,5 @@ module.exports = {
},
],
},
plugins: [new ReactRefreshRspackPlugin()],
plugins: [new PreactRefreshRspackPlugin()],
};
6 changes: 2 additions & 4 deletions test/hotCases/jsx/basic/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const {
default: ReactRefreshRspackPlugin,
} = require('../../../../dist/index.js');
const { PreactRefreshRspackPlugin } = require('../../../../dist/index.js');

/** @type {import('@rspack/core').Configuration} */
module.exports = {
Expand Down Expand Up @@ -55,5 +53,5 @@ module.exports = {
},
],
},
plugins: [new ReactRefreshRspackPlugin()],
plugins: [new PreactRefreshRspackPlugin()],
};
6 changes: 2 additions & 4 deletions test/hotCases/jsx/child/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const {
default: ReactRefreshRspackPlugin,
} = require('../../../../dist/index.js');
const { PreactRefreshRspackPlugin } = require('../../../../dist/index.js');

/** @type {import('@rspack/core').Configuration} */
module.exports = {
Expand Down Expand Up @@ -55,5 +53,5 @@ module.exports = {
},
],
},
plugins: [new ReactRefreshRspackPlugin()],
plugins: [new PreactRefreshRspackPlugin()],
};
6 changes: 2 additions & 4 deletions test/hotCases/jsx/value/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const {
default: ReactRefreshRspackPlugin,
} = require('../../../../dist/index.js');
const { PreactRefreshRspackPlugin } = require('../../../../dist/index.js');

/** @type {import('@rspack/core').Configuration} */
module.exports = {
Expand Down Expand Up @@ -55,5 +53,5 @@ module.exports = {
},
],
},
plugins: [new ReactRefreshRspackPlugin()],
plugins: [new PreactRefreshRspackPlugin()],
};
6 changes: 2 additions & 4 deletions test/hotCases/jsx/with-same-name-component/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const {
default: ReactRefreshRspackPlugin,
} = require('../../../../dist/index.js');
const { PreactRefreshRspackPlugin } = require('../../../../dist/index.js');

/** @type {import('@rspack/core').Configuration} */
module.exports = {
Expand Down Expand Up @@ -55,5 +53,5 @@ module.exports = {
},
],
},
plugins: [new ReactRefreshRspackPlugin()],
plugins: [new PreactRefreshRspackPlugin()],
};
6 changes: 2 additions & 4 deletions test/hotCases/with-worker/basic/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const {
default: ReactRefreshRspackPlugin,
} = require('../../../../dist/index.js');
const { PreactRefreshRspackPlugin } = require('../../../../dist/index.js');

/** @type {import('@rspack/core').Configuration} */
module.exports = {
Expand Down Expand Up @@ -66,5 +64,5 @@ module.exports = {
},
},
},
plugins: [new ReactRefreshRspackPlugin()],
plugins: [new PreactRefreshRspackPlugin()],
};