-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
58 lines (56 loc) · 1.31 KB
/
webpack.config.js
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
const path = require('path')
const production = process.env.NODE_ENV === 'production'
const WebpackDefinePlugin = require('webpack').DefinePlugin
require('dotenv').config({
path: path.resolve(process.cwd(), production ? '.env' : '.env.development')
})
module.exports = {
entry: './plugin/main.jsx',
output: {
path: __dirname,
filename: 'main.js',
libraryTarget: 'commonjs2'
},
devtool: 'none',
externals: {
uxp: 'uxp',
application: 'application'
},
target: 'node',
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
plugins: [
'transform-react-jsx'
]
}
},
{
test: /\.(png|jpg|gif)$/,
exclude: /node_modules/,
loader: 'file-loader'
},
{
test: /\.scss$/,
exclude: /node_modules/,
use: [
'style-loader',
'css-loader',
'sass-loader'
]
}
]
},
plugins: [
new WebpackDefinePlugin({
API_CLIENT_KEY: JSON.stringify(process.env.API_CLIENT_KEY),
SITE_URL: JSON.stringify(process.env.SITE_URL),
API_URL: JSON.stringify(process.env.API_URL),
DEV_BASIC_AUTH: JSON.stringify(!production ? process.env.DEV_BASIC_AUTH : null),
})
]
}