72 lines
1.8 KiB
JavaScript
72 lines
1.8 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: /\.[t|j]sx?$/,
|
|
loader: 'babel-loader',
|
|
exclude: /node_modules/,
|
|
options: {
|
|
presets: [
|
|
[
|
|
'@babel/preset-env',
|
|
{
|
|
useBuiltIns: 'usage',
|
|
corejs: 3,
|
|
modules: false,
|
|
},
|
|
],
|
|
'@babel/preset-typescript',
|
|
'@babel/preset-react',
|
|
],
|
|
},
|
|
},
|
|
{
|
|
test: /[^\.module]\.css$/i,
|
|
use: ['style-loader', 'css-loader', 'postcss-loader'],
|
|
},
|
|
{
|
|
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,
|
|
},
|
|
},
|
|
},
|
|
'postcss-loader',
|
|
'sass-loader',
|
|
],
|
|
},
|
|
],
|
|
},
|
|
plugins: [
|
|
new KintonePlugin({
|
|
manifestJSONPath: './plugin/manifest.json',
|
|
privateKeyPath: './private.ppk',
|
|
pluginZipPath: './dist/plugin.zip',
|
|
}),
|
|
],
|
|
};
|