This repository has been archived by the owner on Oct 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.demo.config.js
70 lines (67 loc) · 2.44 KB
/
webpack.demo.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
var webpack = require('webpack');
var path = require('path');
var CommonsChunkPlugin = require("webpack/lib/optimize/CommonsChunkPlugin");
var HtmlWebpackPlugin = require('html-webpack-plugin');
var npmDir = path.join(__dirname, 'node_modules');
module.exports = {
entry: {
demo: path.join(__dirname, 'src', 'examples', 'demo.jsx'),
reactDemo: path.join(__dirname, 'src', 'examples', 'reactDemo.jsx'),
},
resolve: {
extensions: ['', '.webpack.js', '.web.js', '.js', '.jsx'],
alias: {
},
},
module: {
loaders: [
//{test: /\.ts$|\.tsx$/, loader: 'ts-loader'},
{test: /\.json$/, loader: 'json-loader'},
{test: /\.css$/, loader: 'style-loader!css-loader'},
{test: /\.scss$/, loader: 'style-loader!css-loader!sass-loader'},
{test: /\.jpe?g$/, loader: 'url-loader?mimetype=image/jpeg'},
{test: /\.gif$/, loader: 'url-loader?mimetype=image/gif'},
{test: /\.png$/, loader: 'url-loader?mimetype=image/png'},
{
test: /\.js.?$/,
exclude: /(node_modules)/,
loader: 'babel-loader',
query: {
presets: ['es2015', 'react', 'stage-0']
}
},
],
},
plugins: [
new HtmlWebpackPlugin({
title: 'iKnowBrowser demo',
chunks: ['commons', 'reactDemo'],
template: path.join(__dirname, 'src', 'examples', 'template.ejs'),
}),
new HtmlWebpackPlugin({
filename: 'demo.html',
title: 'iKnowBrowser demo',
chunks: ['commons', 'demo'],
template: path.join(__dirname, 'src', 'examples', 'template.ejs'),
}),
new CommonsChunkPlugin('commons', 'commons.chunk.js'),
],
output: {
path: path.join(__dirname, 'dist', 'examples'),
filename: '[name].bundle.js',
chunkFilename: '[id].chunk.js',
publicPath: '/',
},
devtool: '#source-map',
devServer: {
proxy: {
"**": {
target: process.env.IKNOW_ENDPOINT ? process.env.IKNOW_ENDPOINT : 'http://82.110.159.50:57772/csp/browser/rest/domain/1/' ,
//ignorePath: true,
changeOrigin: true,
secure: false,
auth: process.env.IKNOW_AUTH ? process.env.IKNOW_AUTH : 'EntityBrowser:BrowseM3!'
},
},
},
};