import { defineConfig } from '@rspack/cli'; import { rspack } from '@rspack/core'; import KintonePlugin from '@kintone/webpack-plugin-kintone-plugin'; const isDev = process.env.NODE_ENV === 'development'; // Target browsers, see: https://github.com/browserslist/browserslist const targets = ['last 2 versions', '> 0.2%', 'not dead', 'Firefox ESR']; export default defineConfig({ mode: isDev ? 'development' : 'production', devtool: isDev ? 'inline-cheap-module-source-map' : false, entry: { config: './src/config/index.tsx', desktop: './src/desktop/index.tsx' }, output: { path: './plugin/js', filename: '[name].js', }, resolve: { extensions: ['...', '.ts', '.tsx', '.jsx'], }, module: { rules: [ { test: /\.(jsx?|tsx?)$/, use: [ { loader: 'builtin:swc-loader', options: { jsc: { parser: { syntax: 'typescript', tsx: true, }, }, env: { targets }, }, }, ], }, ], parser: { 'css/auto': { namedExports: false, }, }, }, plugins: [ new KintonePlugin({ manifestJSONPath: './plugin/manifest.json', privateKeyPath: './private.ppk', pluginZipPath: './dist/plugin.zip', }), ], optimization: { minimizer: [ new rspack.SwcJsMinimizerRspackPlugin(), new rspack.LightningCssMinimizerRspackPlugin({ minimizerOptions: { targets }, }), ], }, experiments: { css: true, }, performance: { maxEntrypointSize: 1024000, maxAssetSize: 1024000, }, });