Files
kintone-plugin-filelookup/rspack.config.js
2025-06-17 14:03:55 +09:00

100 lines
2.5 KiB
JavaScript

/* eslint-env node */
const path = require('path');
const KintonePlugin = require('@kintone/webpack-plugin-kintone-plugin');
const isProduction = process.env.NODE_ENV === 'production';
module.exports = {
mode: isProduction ? 'production' : 'development',
devtool: isProduction ? false : 'inline-cheap-module-source-map',
entry: { config: './src/config/index.tsx', desktop: './src/desktop/index.tsx' },
output: {
path: path.resolve(__dirname, 'plugin', 'js'),
filename: '[name].js',
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
},
module: {
rules: [
{
test: /\.(j|t)s$/,
exclude: [/[\\/]node_modules[\\/]/],
loader: 'builtin:swc-loader',
options: {
sourceMaps: !isProduction,
jsc: {
parser: {
syntax: 'typescript',
},
transform: {
react: {
runtime: 'automatic',
development: !isProduction,
},
},
externalHelpers: true,
},
env: {
targets: 'Chrome >= 48',
},
},
},
{
test: /\.(j|t)sx$/,
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,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
importLoaders: 1,
sourceMap: !isProduction,
modules: {
localIdentName: isProduction ? '[hash:base64]' : '[name]__[local]--[hash:base64:5]',
namedExport: false,
},
},
},
],
},
],
},
plugins: [
new KintonePlugin({
manifestJSONPath: './plugin/manifest.json',
privateKeyPath: './private.ppk',
pluginZipPath: './dist/plugin.zip',
}),
],
};