This repository has been archived by the owner on Sep 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
webpack.config.tz.js
124 lines (122 loc) · 4.12 KB
/
webpack.config.tz.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
122
123
124
/* webpack.config.js */
var WebpackAutoInject = require('webpack-auto-inject-version')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var CopyWebpackPlugin = require('copy-webpack-plugin')
var OfflinePlugin = require('offline-plugin')
// var HtmlIncluderWebpackPlugin = require('html-includer-webpack-plugin').default;
var Clean = require('clean-webpack-plugin')
var path = require('path')
console.log(path.resolve(__dirname))
module.exports = {
// Tell Webpack which file kicks off our app.
entry: path.resolve(__dirname, 'app/index.tz.js'),
// Tell Weback to output our bundle to ./dist/bundle.js
output: {
filename: '[name].[contenthash].bundle.js',
path: path.resolve(__dirname, 'dist-tz')
},
// Tell Webpack which directories to look in to resolve import statements.
// Normally Webpack will look in node_modules by default but since we’re overriding
// the property we’ll need to tell it to look there in addition to the
// bower_components folder.
resolve: {
modules: [
path.resolve(__dirname, 'node_modules'),
],
extensions: ['.ts', '.tsx', '.js', '.jsx', '.html'],
alias: { '@polymer/iron-selector': path.resolve(__dirname, 'node_modules/@taktik/iron-selector-meta-shift')}
},
devtool: 'eval-source-map',
node: {
fs: 'empty'
},
module: {
rules: [
{
// If you see a file that ends in .js, just send it to the babel-loader.
test: /\.js$/,
use: [{
loader: 'babel-loader',
options: {
plugins: ['syntax-dynamic-import']
}
}],
exclude: /(node_modules)/
},
{
test: /\.ts$/,
use: [{loader: 'ts-loader', options: { /*allowTsInNodeModules: true*/ }}]
},
{
test: /\.(gif|png|jpe?g|svg)$/i,
use: [{
loader: "url-loader",
options: {
limit: 10000,
},
}],
}
]
},
mode: 'development',
plugins: [
// This plugin will generate an index.html file for us that can be use
// by the Webpack dev server. We can give it a template file (written in EJS)
// and it will handle injecting our bundle for us.
new WebpackAutoInject({
components: {
AutoIncreaseVersion: false
}
}),
new HtmlWebpackPlugin({
inject: false,
debug: true,
template: path.resolve(__dirname, 'app/index.tz.ejs'),
}),
new OfflinePlugin({
// Unless specified in webpack's configuration itself
publicPath: '/',
autoUpdate: 1000*60*30,
appShell: '/',
externals: [
'/'
],
excludes: [
'docs/*.pdf','app/docs/*.pdf'
],
ServiceWorker: {
events: true
}
}),
// This plugin will copy files over to ‘./dist’ without transforming them.
// That's important because the custom-elements-es5-adapter.js MUST
// remain in ES2015. We’ll talk about this a bit later :)
new CopyWebpackPlugin([{
from: path.resolve(__dirname, 'node_modules/@webcomponents/webcomponentsjs/*.js'),
to: 'scripts/webcomponentsjs/[name].[ext]'
},{
from : path.resolve(__dirname, 'app/docs/*.pdf'),
to: 'docs/[name].[ext]'
}]),
new Clean(['dist-tz']),
],
devServer: {
contentBase: path.join(__dirname,'dist-tz'),
compress: true,
overlay: true,
port: 9000,
proxy: {
'/rest/v1': {
//target: 'https://icure.cloud',
target: 'http://127.0.0.1:16043',
changeOrigin: true
},
'/ws': {
//target: 'wss://icure.cloud',
target: 'ws://127.0.0.1:16043',
ws: true,
changeOrigin: true
}
}
},
}