use rspack instead of webpack.

This commit is contained in:
2025-05-27 19:25:27 +09:00
parent 191fe24ed2
commit fffa5fc1cd
3 changed files with 2341 additions and 2724 deletions

4981
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,8 +5,8 @@
"prepare": "node scripts/prepare-private-key.js", "prepare": "node scripts/prepare-private-key.js",
"start": "node scripts/npm-start.js", "start": "node scripts/npm-start.js",
"develop": "npm run build -- --watch", "develop": "npm run build -- --watch",
"build": "npm run prepare && cross-env NODE_ENV=development webpack", "build": "npm run prepare && cross-env NODE_ENV=development rspack build",
"build:prod": "npm run prepare && cross-env NODE_ENV=production webpack", "build:prod": "npm run prepare && cross-env NODE_ENV=production rspack build",
"dts-gen": "kintone-dts-gen", "dts-gen": "kintone-dts-gen",
"lint": "eslint src --ext .js,.jsx,.ts,.tsx", "lint": "eslint src --ext .js,.jsx,.ts,.tsx",
"upload": "env-cmd --silent kintone-plugin-uploader dist/plugin.zip --watch --waiting-dialog-ms 3000" "upload": "env-cmd --silent kintone-plugin-uploader dist/plugin.zip --watch --waiting-dialog-ms 3000"
@ -27,33 +27,25 @@
"tiny-invariant": "^1.3.3" "tiny-invariant": "^1.3.3"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.27.1",
"@babel/preset-env": "^7.27.2",
"@babel/preset-react": "^7.27.1",
"@babel/preset-typescript": "^7.27.1",
"@cybozu/eslint-config": "^24.0.0", "@cybozu/eslint-config": "^24.0.0",
"@kintone/dts-gen": "^8.1.2", "@kintone/dts-gen": "^8.1.2",
"@kintone/plugin-uploader": "^9.1.5", "@kintone/plugin-uploader": "^9.1.5",
"@kintone/webpack-plugin-kintone-plugin": "^8.0.11", "@kintone/webpack-plugin-kintone-plugin": "^8.0.11",
"@rspack/cli": "^1.3.12",
"@rspack/core": "^1.3.12",
"@shin-chan/kypes": "^0.0.7", "@shin-chan/kypes": "^0.0.7",
"@swc/helpers": "^0.5.17",
"@types/file-saver": "^2.0.7", "@types/file-saver": "^2.0.7",
"@types/react": "^19.1.5", "@types/react": "^19.1.5",
"@types/react-dom": "^19.1.5", "@types/react-dom": "^19.1.5",
"ajv": "^8.17.1",
"babel-loader": "^10.0.0",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"css-loader": "^7.1.2", "css-loader": "^7.1.2",
"env-cmd": "^10.1.0", "env-cmd": "^10.1.0",
"eslint": "^9.27.0", "eslint": "^9.27.0",
"eslint-plugin-react": "^7.37.5", "eslint-plugin-react": "^7.37.5",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"postcss-loader": "^8.1.1",
"prettier": "^3.5.3", "prettier": "^3.5.3",
"sass": "^1.89.0",
"sass-loader": "^16.0.5",
"style-loader": "^4.0.0", "style-loader": "^4.0.0",
"typescript": "^5.8.3", "typescript": "^5.8.3"
"webpack": "^5.99.9",
"webpack-cli": "^6.0.1"
} }
} }

View File

@ -1,4 +1,5 @@
/* eslint-env node */ /* eslint-env node */
const path = require('path'); const path = require('path');
const KintonePlugin = require('@kintone/webpack-plugin-kintone-plugin'); const KintonePlugin = require('@kintone/webpack-plugin-kintone-plugin');
@ -18,27 +19,56 @@ module.exports = {
module: { module: {
rules: [ rules: [
{ {
test: /\.[t|j]sx?$/, test: /\.(j|t)s$/,
loader: 'babel-loader', exclude: [/[\\/]node_modules[\\/]/],
exclude: /node_modules/, loader: 'builtin:swc-loader',
options: { options: {
presets: [ sourceMaps: !isProduction,
[ jsc: {
'@babel/preset-env', parser: {
{ syntax: 'typescript',
useBuiltIns: 'usage', },
corejs: 3, transform: {
modules: false, react: {
runtime: 'automatic',
development: !isProduction,
}, },
], },
'@babel/preset-typescript', externalHelpers: true,
'@babel/preset-react', },
], env: {
targets: 'Chrome >= 48',
},
}, },
}, },
{ {
test: /[^\.module]\.css$/i, test: /\.(j|t)sx$/,
use: ['style-loader', 'css-loader', 'postcss-loader'], loader: 'builtin:swc-loader',
exclude: [/[\\/]node_modules[\\/]/],
options: {
sourceMaps: !isProduction,
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
},
transform: {
react: {
runtime: 'automatic',
development: !isProduction,
},
},
externalHelpers: true,
},
env: {
targets: 'Chrome >= 48', // browser compatibility
},
},
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
exclude: /\.module\.css$/,
}, },
{ {
test: /\.module\.css$/i, test: /\.module\.css$/i,
@ -55,8 +85,6 @@ module.exports = {
}, },
}, },
}, },
'postcss-loader',
'sass-loader',
], ],
}, },
], ],