-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.config.js
51 lines (50 loc) · 1.21 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
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const webpack = require("webpack");
const fs = require('fs')
const packageJson = fs.readFileSync('./package.json')
const version = JSON.parse(packageJson).version || 0
const nodeExternals = require('webpack-node-externals')
module.exports = {
mode: 'production',
entry: './src/components/FreestarAdSlot/index.js',
output: {
path: path.resolve('dist'),
filename: 'index.js',
libraryTarget: "commonjs2"
},
module: {
rules: [
{
test: /\.js?$/,
exclude: /(node_modules)/,
use: 'babel-loader',
}
],
},
resolve: {
alias: {
'react': path.resolve(__dirname, './node_modules/react'),
'prop-types' : path.resolve(__dirname, './node_modules/prop-types'),
}
},
externals: {
react: {
commonjs: "react",
commonjs2: "react",
amd: "React",
root: "React"
},
'prop-types': {
root: 'PropTypes',
commonjs2: 'prop-types',
commonjs: 'prop-types',
amd: 'prop-types'
}},
plugins: [
new CleanWebpackPlugin(),
new webpack.DefinePlugin({
__PACKAGE_VERSION__: '"' + version + '"'
})
]
};