-
Notifications
You must be signed in to change notification settings - Fork 79
/
library.config.js
51 lines (50 loc) · 1.23 KB
/
library.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 webpack = require('webpack');
module.exports = {
entry: {
library: ['./app/scripts/prototypo.js/index.js'],
},
output: {
path: path.join(__dirname, 'app/scripts/prototypo.js/dist'),
publicPath: '',
chunkFilename: '[name].bundle.js',
filename: '[name].js',
libraryTarget: 'umd',
library: 'Ptypo',
},
module: {
strictExportPresence: true,
rules: [
{
test: /\.jsx?$/,
use: [
{loader: 'babel-loader', options: {cacheDirectory: true}},
'if-loader',
],
include: [path.join(__dirname, 'app')],
},
],
noParse: /(levelup)/,
},
plugins: [
new webpack.LoaderOptionsPlugin({
options: {
'if-loader': 'prod',
},
}),
new webpack.DefinePlugin({
'process.env': {
LIBRARY: true,
},
}),
// Moment.js is an extremely popular library that bundles large locale files
// by default due to how Webpack interprets its code. This is a practical
// solution that requires the user to opt into importing specific locales.
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
// You can remove this if you don't use Moment.js:
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
],
resolve: {
extensions: ['.js', '.jsx'],
},
};