-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.cjs
More file actions
75 lines (70 loc) · 1.98 KB
/
webpack.config.cjs
File metadata and controls
75 lines (70 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* eslint-disable no-undef */
const path = require("path");
const TerserPlugin = require("terser-webpack-plugin");
const KintonePlugin = require("@kintone/webpack-plugin-kintone-plugin");
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
const packageJson = require("./package.json");
const pluginVersion = packageJson.version;
const pluginName = packageJson.name;
// https://webpack.js.org/configuration/mode/#mode-none
module.exports = (env, arg) => {
return {
entry: {
desktop: "./src/ts/desktop/index.tsx",
config: "./src/ts/config/config.tsx",
},
output: {
path: path.resolve(__dirname, "plugin", "js"),
filename: `${pluginName}-v${pluginVersion}-[name].js`,
},
plugins: [
new KintonePlugin({
manifestJSONPath: "./plugin/manifest.json",
privateKeyPath: "./private.ppk",
pluginZipPath: "./dist/plugin.zip",
}),
],
target: ["web", "es6"],
module: {
rules: [
{
test: /\.tsx?$/,
use: [
{
loader: "babel-loader",
options: {
presets: ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript"],
plugins: ["@babel/plugin-transform-runtime"],
cacheDirectory: true,
},
},
],
exclude: /node_modules/,
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
},
],
},
resolve: {
extensions: [".ts", ".tsx", ".js", ".json"],
plugins: [new TsconfigPathsPlugin({ configFile: "./tsconfig.json" })],
},
devtool: arg.mode === "development" ? "inline-source-map" : false,
cache: {
type: "filesystem",
buildDependencies: {
config: [__filename],
},
},
optimization: {
// not to extract license comment
minimizer: [
new TerserPlugin({
extractComments: false,
}),
],
},
};
};