This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
/
webpack.pack.no.umd.conf.js
75 lines (74 loc) · 1.76 KB
/
webpack.pack.no.umd.conf.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
const path = require('path');
const webpack = require('webpack');
const FlowStatusWebpackPlugin = require('flow-status-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const pkgjson = require('./package.json');
module.exports = {
module: {
rules: [
{
enforce: 'pre',
test: /\.js$/,
exclude: /node_modules/,
loader: 'eslint-loader',
},
{
test: /index.js$/,
exclude: /node_modules/,
use: {
loader: 'string-replace-loader',
query: {
search: '@@VERSION',
replace: pkgjson.version,
},
},
},
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['flow', 'es2015', 'stage-0'],
},
},
},
{
test: /\.scss$/,
exclude: /node_modules/,
use: ExtractTextPlugin.extract({
use: [{
loader: 'css-loader',
options: { minimize: true },
}, {
loader: 'sass-loader',
}],
// use style-loader in development
fallback: 'style-loader',
}),
},
],
},
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new FlowStatusWebpackPlugin({
failOnError: true,
}),
new ExtractTextPlugin('json-pollock.min.css'),
new webpack.optimize.UglifyJsPlugin({
include: /\.min\.js$/,
minimize: true,
}),
],
entry: {
'json-pollock.global.min': './index.js',
},
devtool: 'source-map',
output: {
filename: '[name].js',
library: 'JsonPollock',
libraryTarget: 'this',
publicPath: '/dist/',
path: path.resolve(__dirname, 'dist'),
},
};