Skip to content

Commit

Permalink
chore: prefer to use named import (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Jan 13, 2025
1 parent 3a0a156 commit 2d5a744
Show file tree
Hide file tree
Showing 60 changed files with 74 additions and 75 deletions.
2 changes: 1 addition & 1 deletion rsdoctor/rspack/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const ReactRefreshPlugin = require('@rspack/plugin-react-refresh');
const { RsdoctorRspackPlugin } = require('@rsdoctor/rspack-plugin');

Expand Down
2 changes: 1 addition & 1 deletion rspack/cra-ts/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const ReactRefreshPlugin = require('@rspack/plugin-react-refresh');
/** @type {import('@rspack/cli').Configuration} */
const config = {
Expand Down
2 changes: 1 addition & 1 deletion rspack/cra/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const ReactRefreshPlugin = require('@rspack/plugin-react-refresh');
/** @type {import('@rspack/cli').Configuration} */
const config = {
Expand Down
2 changes: 1 addition & 1 deletion rspack/css-parser-generator-options/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require('path');
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');

/** @type {import('@rspack/cli').Configuration} */
const config = {
Expand Down
13 changes: 6 additions & 7 deletions rspack/dll-reference/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

const rspack = require('@rspack/core')
const { rspack } = require('@rspack/core');
const path = require('node:path');

/** @type {import('@rspack/cli').Configuration} */
Expand All @@ -9,7 +8,7 @@ const config = {
path: path.resolve(__dirname, 'dist'),
},
resolve: {
extensions: ['...', '.ts', '.tsx', '.js', '.jsx']
extensions: ['...', '.ts', '.tsx', '.js', '.jsx'],
},
plugins: [
new rspack.DllReferencePlugin({
Expand All @@ -19,10 +18,10 @@ const config = {
new rspack.DllReferencePlugin({
manifest: path.resolve(__dirname, '../dll/dist/beta.manifest.json'),
scope: 'beta',
extensions: [".js", ".jsx", '.ts', '.tsx']
extensions: ['.js', '.jsx', '.ts', '.tsx'],
}),
],
mode: 'development'
}
mode: 'development',
};

module.exports = config;
module.exports = config;
19 changes: 9 additions & 10 deletions rspack/dll/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

const rspack = require('@rspack/core')
const { rspack } = require('@rspack/core');
const path = require('node:path');

/** @type {import('@rspack/cli').Configuration} */
Expand All @@ -8,20 +7,20 @@ const config = {
extensions: ['...', '.ts', '.tsx', '.js', '.jsx'],
},
entry: {
alpha: ["./alpha", "./a", "lodash"],
beta: ["./beta", "./b", "./c"],
alpha: ['./alpha', './a', 'lodash'],
beta: ['./beta', './b', './c'],
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].dll.js',
library: '[name]_dll_lib'
library: '[name]_dll_lib',
},
plugins: [
new rspack.DllPlugin({
path: path.join(__dirname, "dist", "[name].manifest.json"),
path: path.join(__dirname, 'dist', '[name].manifest.json'),
name: '[name]_dll_lib',
})
]
}
}),
],
};

module.exports = config;
module.exports = config;
2 changes: 1 addition & 1 deletion rspack/emotion/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: {
Expand Down
2 changes: 1 addition & 1 deletion rspack/extract-license/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
/** @type {import('@rspack/cli').Configuration} */
const config = {
context: __dirname,
Expand Down
2 changes: 1 addition & 1 deletion rspack/hooks/after-resolve/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: './src/index.js',
Expand Down
2 changes: 1 addition & 1 deletion rspack/lightingcss-loader/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: './src/index.js',
Expand Down
3 changes: 2 additions & 1 deletion rspack/minify-test/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const rspack = require('../../packages/rspack');
const { rspack } = require('../../packages/rspack');

/**
* @type {import("@rspack/core").Configuration}
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ReactRefreshPlugin = require('@rspack/plugin-react-refresh');
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');

const isProduction = process.env.NODE_ENV === 'production';
const containerName = 'Rspack_MF_v1_5';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ReactRefreshPlugin = require('@rspack/plugin-react-refresh');
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');

const isProduction = process.env.NODE_ENV === 'production';
const containerName = 'Rspack_MF_v1';
Expand Down
2 changes: 1 addition & 1 deletion rspack/module-federation-v1.5/app/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ReactRefreshPlugin = require('@rspack/plugin-react-refresh');
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');

const isProduction = process.env.NODE_ENV === 'production';

Expand Down
2 changes: 1 addition & 1 deletion rspack/module-federation-v1.5/lib1/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ReactRefreshPlugin = require('@rspack/plugin-react-refresh');
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');

const isProduction = process.env.NODE_ENV === 'production';

Expand Down
2 changes: 1 addition & 1 deletion rspack/module-federation-v1.5/lib2/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('path');
const ReactRefreshPlugin = require('@rspack/plugin-react-refresh');
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');

const isProduction = process.env.NODE_ENV === 'production';

Expand Down
2 changes: 1 addition & 1 deletion rspack/module-federation-v1/app/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ReactRefreshPlugin = require('@rspack/plugin-react-refresh');
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');

const isProduction = process.env.NODE_ENV === 'production';

Expand Down
2 changes: 1 addition & 1 deletion rspack/module-federation-v1/lib1/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ReactRefreshPlugin = require('@rspack/plugin-react-refresh');
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');

const isProduction = process.env.NODE_ENV === 'production';

Expand Down
2 changes: 1 addition & 1 deletion rspack/module-federation-v1/lib2/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('path');
const ReactRefreshPlugin = require('@rspack/plugin-react-refresh');
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');

const isProduction = process.env.NODE_ENV === 'production';

Expand Down
2 changes: 1 addition & 1 deletion rspack/monaco-editor-js/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const path = require('path');

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion rspack/monaco-editor-ts-react/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const path = require('path');

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion rspack/monaco-editor-webpack-plugin/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('path');
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');

module.exports = {
entry: {
Expand Down
2 changes: 1 addition & 1 deletion rspack/multi-entry/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');

/** @type {import('@rspack/cli').Configuration} */
const config = {
Expand Down
2 changes: 1 addition & 1 deletion rspack/nestjs/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { RunScriptWebpackPlugin } = require('run-script-webpack-plugin');
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');

/** @type {import('@rspack/cli').Configuration} */
const config = {
Expand Down
2 changes: 1 addition & 1 deletion rspack/node-globals-shim/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const path = require('path');
/** @type {import('@rspack/cli').Configuration} */
const config = {
Expand Down
2 changes: 1 addition & 1 deletion rspack/node-polyfill/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');

/** @type {import('@rspack/cli').Configuration} */
Expand Down
2 changes: 1 addition & 1 deletion rspack/perfsee/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const { PerfseePlugin } = require('@perfsee/webpack');
/** @type {import('@rspack/cli').Configuration} */
const config = {
Expand Down
2 changes: 1 addition & 1 deletion rspack/polyfill/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const path = require('path');
/** @type {import('@rspack/cli').Configuration} */
const config = {
Expand Down
2 changes: 1 addition & 1 deletion rspack/postcss-loader/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
/** @type {import('@rspack/cli').Configuration} */
const config = {
context: __dirname,
Expand Down
2 changes: 1 addition & 1 deletion rspack/preact-refresh/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const PreactRefreshPlugin = require('@rspack/plugin-preact-refresh');
const dev = process.env.NODE_ENV === 'development';
/** @type {import('@rspack/cli').Configuration} */
Expand Down
2 changes: 1 addition & 1 deletion rspack/preact/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const dev = process.env.NODE_ENV === 'development';
/** @type {import('@rspack/cli').Configuration} */
const config = {
Expand Down
2 changes: 1 addition & 1 deletion rspack/proxy/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const path = require('path');
module.exports = (env, argv) => {
console.log('env:', env, argv);
Expand Down
2 changes: 1 addition & 1 deletion rspack/react-compiler-babel-ts/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: {
Expand Down
2 changes: 1 addition & 1 deletion rspack/react-compiler-babel/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: {
Expand Down
2 changes: 1 addition & 1 deletion rspack/react-refresh-babel-loader/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const ReactRefreshPlugin = require('@rspack/plugin-react-refresh');

const isProduction = process.env.NODE_ENV === 'production';
Expand Down
2 changes: 1 addition & 1 deletion rspack/react-refresh/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const ReactRefreshPlugin = require('@rspack/plugin-react-refresh');

const isProduction = process.env.NODE_ENV === 'production';
Expand Down
2 changes: 1 addition & 1 deletion rspack/react-with-extract-css/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const path = require('path');

/** @type {import('@rspack/cli').Configuration} */
Expand Down
2 changes: 1 addition & 1 deletion rspack/react-with-less/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const path = require('path');
/** @type {import('@rspack/cli').Configuration} */
const config = {
Expand Down
2 changes: 1 addition & 1 deletion rspack/react-with-sass/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: {
Expand Down
2 changes: 1 addition & 1 deletion rspack/react/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: {
Expand Down
2 changes: 1 addition & 1 deletion rspack/sentry/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const { sentryWebpackPlugin } = require('@sentry/webpack-plugin');
/** @type {import('@rspack/cli').Configuration} */
const config = {
Expand Down
2 changes: 1 addition & 1 deletion rspack/solid/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
/** @type {import('@rspack/cli').Configuration} */
const config = {
context: __dirname,
Expand Down
2 changes: 1 addition & 1 deletion rspack/source-map-with-vscode-debugging/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const path = require('path');

/** @type {import('@rspack/cli').Configuration} */
Expand Down
2 changes: 1 addition & 1 deletion rspack/stats/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
class StatsPrinterTestPlugin {
apply(compiler) {
compiler.hooks.compilation.tap('StatsPrinterTestPlugin', (compilation) => {
Expand Down
2 changes: 1 addition & 1 deletion rspack/styled-components/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: {
Expand Down
2 changes: 1 addition & 1 deletion rspack/svgr/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
/** @type {import('@rspack/cli').Configuration} */
const config = {
entry: {
Expand Down
2 changes: 1 addition & 1 deletion rspack/tailwind-jit/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
/** @type {import('@rspack/cli').Configuration} */
const config = {
context: __dirname,
Expand Down
2 changes: 1 addition & 1 deletion rspack/tailwind/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
/**
* @type {import('@rspack/cli').Configuration}
*/
Expand Down
2 changes: 1 addition & 1 deletion rspack/terser-webpack-plugin/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { defineConfig } = require('@rspack/cli');
const TerserPlugin = require('terser-webpack-plugin');
const { StatsWriterPlugin } = require('webpack-stats-plugin');
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');

module.exports = defineConfig({
plugins: [new StatsWriterPlugin()],
Expand Down
2 changes: 1 addition & 1 deletion rspack/treeshaking-transform-imports/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
/** @type {import('@rspack/core').Configuration} */
const config = {
context: __dirname,
Expand Down
2 changes: 1 addition & 1 deletion rspack/vue/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const { VueLoaderPlugin } = require('vue-loader');

/** @type {import('@rspack/cli').Configuration} */
Expand Down
2 changes: 1 addition & 1 deletion rspack/vue2-ts/rspack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const rspack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const { VueLoaderPlugin } = require('vue-loader');

/** @type {import('@rspack/cli').Configuration} */
Expand Down
Loading

0 comments on commit 2d5a744

Please sign in to comment.