-
Notifications
You must be signed in to change notification settings - Fork 16
/
webpack.common.js
121 lines (120 loc) · 3.83 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
117
118
119
120
121
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const combineLoaders = require('webpack-combine-loaders');
const autoprefixer = require('autoprefixer');
const osassets = './assets/src/';
/** see below for multiple configurations.
*/
/** https://webpack.js.org/configuration/configuration-types/#exporting-multiple-configurations */
module.exports = [
{
configName: 'os-common',
entry: {
'common' : [
'babel-polyfill',
osassets + 'os-common.js'
]
},
externals: {
jquery : "jQuery"
},
module: {
rules: [
{ test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" }
]
},
output: {
filename: 'osjs.[chunkhash].dist.js',
path: path.resolve(__dirname, 'assets/dist'),
library: ['osjs'],
libraryTarget: 'this'
},
},
{
configName: 'os-admin-global',
entry: {
'admin-global': [
osassets + 'admin-main.js'
]
},
externals: {
jquery : "jQuery",
osjs : 'osjs'
},
module: {
rules: [
{ test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" }
]
},
output: {
filename: 'os-[name].[chunkhash].dist.js',
path: path.resolve(__dirname, 'assets/dist'),
library: ['osAdminGlobal'],
libraryTarget: 'this'
},
},
{
configName: 'base',
entry: {
'frontend-global': [
osassets + 'frontend.js'
],
'admin-settings' : [
osassets + 'admin-settings.js',
osassets + 'license-management.js'
]
},
externals: {
jquery : "jQuery",
osjs : 'osjs',
osAdminGlobal : 'osAdminGlobal'
},
output: {
filename: '[name].[chunkhash].dist.js',
path: path.resolve(__dirname, 'assets/dist')
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader"
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract(
combineLoaders([
{
loader: 'css-loader',
query: {
modules: true,
localIdentName: '[local]',
},
//can't use minimize because cssnano (the
// dependency) doesn't parser the browserlist
// extension in package.json correctly, there's
// a pending update for it but css-loader
// doesn't have the latest yet.
// options: {
// minimize: true
// }
},
{
loader: 'postcss-loader',
options: {
plugins: function() {
return [autoprefixer];
},
sourceMap: true,
},
},
])
)
},
]
},
watchOptions: {
poll: 1000,
},
}
];