-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
99 lines (96 loc) · 2.27 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
const path = require("path");
const webpack = require("webpack");
const autoprefixer = require("autoprefixer");
const precss = require("precss");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
entry: {
index: "./demo/index.js"
},
output: {
path: path.join(__dirname, "docs"),
filename: "[name].js",
chunkFilename: "chunk/[name].js",
publicPath: "./"
},
plugins: [
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify("production")
}
}),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false,
drop_console: true
}
}),
new HtmlWebpackPlugin({
title: "Image Cropper",
template: "index.ejs",
env: "prod"
})
],
resolve: {
alias: {
_: path.resolve(__dirname, "src"),
demo: path.resolve(__dirname, "demo")
},
root: path.resolve("src"),
modulesDirectories: ["node_modules"],
extensions: ["", ".js"]
},
module: {
loaders: [
{
test: /\.jsx?$/,
loader: "babel-loader"
},
{ test: /\.tsx?$/, loader: "babel-loader!ts-loader" },
{
test: /\.(css|less)$/,
loader: "style-loader!css-loader!postcss-loader!less-loader"
},
{
test: /\.(ttf|eot|woff|woff2|otf|svg)/,
loader: "file-loader?name=./fonts/[name].[ext]"
},
{
test: /\.scss$/,
loaders: [
"style-loader",
"css-loader?modules&localIdentName=[name]-[local]",
"postcss-loader",
"sass-loader"
]
},
{
test: /\.(png|jpg|jpeg|gif)$/,
loader: "url-loader?limit=10000&name=./images/[name].[ext]"
}
]
},
babel: {
presets: ["react", "es2015"],
plugins: ["transform-object-rest-spread"]
},
postcss: function() {
return [autoprefixer({ browsers: ["> 1%", "IE 9"] }), precss];
},
ts: {
transpileOnly: true,
declaration: false,
compilerOptions: {
baseUrl: ".",
paths: {
"_/*": ["./src/*"]
},
target: "es6",
jsx: "preserve",
moduleResolution: "node",
sourceMap: true
},
files: ["i-really-hope-you-dont-have-a-file-with-this-name"]
}
};