-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
86 lines (80 loc) · 2.91 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
const webpack = require('webpack');
const path = require('path');
const packageJson = require('./package.json');
const eoxcPackageJson = require('eoxc/package.json');
module.exports = {
entry: {
'code-de': ['babel-polyfill', './src/preload.js', './src/main.js'],
},
resolve: {
// mainFields: ['module', 'main'],
modulesDirectories: ['web_modules', 'node_modules', 'bower_components'],
// packageMains: ['webpack', 'web', 'browserify', ['jam', 'main'], 'main'],
alias: {
// necessary to avoid multiple packings of backbone due to marionette
backbone: path.join(__dirname, 'node_modules', 'backbone', 'backbone'),
handlebars: 'handlebars/dist/handlebars.min.js',
'opensearch-browser': 'opensearch-browser/dist',
jquery: path.join(__dirname, 'node_modules/jquery/src/jquery'),
// Bind version of jquery
//jquery: path.join(__dirname, 'node_modules', 'jquery'),
// Bind version of jquery-ui
//'jquery-ui': path.join(__dirname, 'node_modules', 'jquery-ui'),
// jquery-ui doesn't contain a index file
// bind module to the complete module
},
},
resolveLoader: {
root: path.join(__dirname, 'node_modules'),
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].bundle.js',
library: 'code-de',
libraryTarget: 'umd',
},
devServer: {
host: '0.0.0.0',
inline: true,
disableHostCheck: true,
},
module: {
loaders: [
{ test: /node_modules.*eoxc.*js$/, loader: 'babel-loader' },
{ test: /node_modules.*opensearch.*js$/, loader: 'babel-loader' },
{ test: /node_modules.*ol.*js$/, loader: 'babel-loader' },
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' },
{ test: /\.json$/, loader: 'json-loader' },
{ test: /\.coffee$/, loader: 'coffee-loader' },
{ test: /\.litcoffee$/, loader: 'coffee-loader?literate' },
{ test: /\.css$/, loaders: ['style', 'css', 'postcss'] },
{ test: /\.less$/, loaders: ['style', 'css', 'postcss', 'less'] },
{ test: /\.scss$/, loaders: ['style', 'css', 'postcss', 'sass'] },
{ test: /\.hbs$/, loader: 'handlebars-loader?helperDirs[]=' + __dirname + '/src/helpers' },
// for anything that might be included in a css
{ test: /\.(png|woff|woff2|eot|ttf|otf|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url-loader?limit=4000000' },
],
},
plugins: [
new webpack.ResolverPlugin(
new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin('.bower.json', ['main'])
),
new webpack.optimize.DedupePlugin(),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
Promise: 'bluebird'
}),
new webpack.BannerPlugin(
`CODE-DE version: ${packageJson.version}\neoxc version: ${eoxcPackageJson.version}`
),
],
postcss() {
return [
require('autoprefixer'),
];
},
devtool: 'source-map',
cache: true,
};