forked from nyaruka/floweditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.js
116 lines (114 loc) · 3.7 KB
/
webpack.common.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
const {
ProvidePlugin,
LoaderOptionsPlugin,
EnvironmentPlugin
} = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const { join } = require('path');
const paths = {
app: './examples/src/app',
dist: join(__dirname, '/examples/dist'),
lib: join(__dirname, 'src/lib')
};
module.exports = {
entry: [paths.app],
output: {
path: paths.dist,
filename: 'floweditor.js',
publicPath: ''
},
resolve: {
extensions: ['.ts', '.tsx', '.js']
},
plugins: [
new ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
}),
new EnvironmentPlugin({
NODE_ENV: 'development',
DEBUG: false
}),
new ExtractTextPlugin('styles.css'),
new LoaderOptionsPlugin({
minimize: true,
debug: false
})
],
module: {
rules: [
{
test: /\.woff(2)?(\?[a-z0-9]+)?$/,
loader: 'url-loader?limit=10000&mimetype=application/font-woff'
},
{
test: /\.(ttf|eot|svg)(\?[a-z0-9]+)?$/,
loader: 'file-loader',
options: {
name: 'fonts/[hash].[ext]'
}
},
{
test: /\.scss$/,
include: paths.lib,
use: ['css-hot-loader'].concat(
ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: 'typings-for-css-modules-loader',
query: {
modules: true,
banner:
'// This file is automatically generated by the "typings-for-css-modules" Webpack loader.\n// https://github.com/Jimdo/typings-for-css-modules-loader\n',
namedExport: true,
camelCase: true,
sourceMap: true,
importLoaders: 2,
localIdentName:
'[name]__[local]___[hash:base64:5]'
}
},
{
loader: 'postcss-loader',
options: {
ident: 'postcss',
plugins: () => [require('autoprefixer')()]
}
},
'sass-loader'
]
})
)
},
{
test: /\.css$/,
exclude: paths.lib,
use: ['style-loader', 'css-loader']
},
{
test: /\.tsx?$/,
use: [
{
loader: 'awesome-typescript-loader',
options: {
useBabel: true,
useCache: true,
silent: process.argv.indexOf('--json') !== -1
}
}
],
exclude: /node_modules/
},
{
test: /\.scss$/,
exclude: paths.lib,
use: [
{ loader: 'style-loader' },
{ loader: 'css-loader' },
{ loader: 'sass-loader' }
]
}
]
}
};