-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
158 lines (152 loc) · 8.64 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
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
const copyright = `
/*! *****************************************************************************************************************************
* Copyright (c) Tuvalsoft Corporation. All rights reserved. *
* *
* ████████╗██╗ ██╗██╗ ██╗ █████╗ ██╗ ███████╗██████╗ █████╗ ███╗ ███╗███████╗██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗ *
* ╚══██╔══╝██║ ██║██║ ██║██╔══██╗██║ ██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝██║ ██║██╔═══██╗██╔══██╗██║ ██╔╝ *
* ██║ ██║ ██║██║ ██║███████║██║ █████╗ ██████╔╝███████║██╔████╔██║█████╗ ██║ █╗ ██║██║ ██║██████╔╝█████╔╝ *
* ██║ ██║ ██║╚██╗ ██╔╝██╔══██║██║ ██╔══╝ ██╔══██╗██╔══██║██║╚██╔╝██║██╔══╝ ██║███╗██║██║ ██║██╔══██╗██╔═██╗ *
* ██║ ╚██████╔╝ ╚████╔╝ ██║ ██║███████╗ ██║ ██║ ██║██║ ██║██║ ╚═╝ ██║███████╗╚███╔███╔╝╚██████╔╝██║ ██║██║ ██╗ *
* ╚═╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚══╝╚══╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ *
* *
* *
* This file is part of Tuval Framework. *
* Copyright (c) Tuvalsoft 2019 All rights reserved. *
* *
* Licensed under the GNU General Public License v3.0. *
* More info at: https://choosealicense.com/licenses/gpl-3.0/ *
* Tuval Framework Created By Tuvalsoft in 2019 *
******************************************************************************************************************************@*/
`;
const path = require('path');
//const DeclarationBundlerPlugin = require('./declaration-bundler-webpack-plugin.fix');
//const CopyWebpackPlugin = require('copy-webpack-plugin');
//const { CleanWebpackPlugin } = require('clean-webpack-plugin');
//const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
//const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
//const TypedocWebpackPlugin = require('typedoc-webpack-plugin');
//const DtsBundleWebpack = require('dts-bundle-webpack');
const fs = require('fs');
const manifest = require('./src/manifest');
const umdConfig = {
mode: 'development',
devtool: 'source-map',
//devtool: 'none',
entry: './src/Application.ts',
externals: {
'@tuval/core': 'tuval$core',
'@tuval/cg': 'tuval$core$graphics',
'@tuval/graphics': 'tuval$graphics',
'@tuval/gui': 'tuval$gui',
'@tuval/forms': 'tuval$forms',
'@tuval/components/buttons': 'tuval$components$buttons',
'@tuval/components/calendars': 'tuval$components$calendars',
'@tuval/components/charts': 'tuval$components$charts',
'@tuval/components/compression': 'tuval$components$compression',
'@tuval/components/core': 'tuval$components$core',
'@tuval/components/data': 'tuval$components$data',
'@tuval/components/diagram': 'tuval$components$diagram',
'@tuval/components/dropdowns': 'tuval$components$dropdowns',
'@tuval/components/excelexport': 'tuval$components$excelexport',
'@tuval/components/filemanager': 'tuval$components$filemanager',
'@tuval/components/fileutils': 'tuval$components$fileutils',
'@tuval/components/grids': 'tuval$components$grids',
'@tuval/components/inputs': 'tuval$components$inputs',
'@tuval/components/layouts': 'tuval$components$layouts',
'@tuval/components/lists': 'tuval$components$lists',
'@tuval/components/navigations': 'tuval$components$navigations',
'@tuval/components/pdfexport': 'tuval$components$pdfexport',
'@tuval/components/popups': 'tuval$components$popups',
'@tuval/components/splitbuttons': 'tuval$components$splitbuttons',
'@tuval/components/svgbase': 'tuval$components$svgbase',
'@tuval/components/query-builder': 'tuval$components$query-builder',
'@tuval/components/spreadsheet': 'tuval$components$spreadsheet'
},
module: {
rules: [
/* {
test: /\.js$/,
use: ['babel-loader', 'webpack-conditional-loader']
}, */
{
test: /\.(wasm|eot|woff|woff2|svg|ttf)([\?]?.*)$/,
type: 'javascript/auto',
loader: 'arraybuffer-loader',
},
{
test: /\.tsx?$/,
//use: 'ts-loader',
use: [
{ loader: "ts-loader" },
// { loader: "ifdef-loader", options: opts }
],
exclude: /node_modules/,
},
{
test: /\.css$/,
use: ['to-string-loader', 'css-loader']
},
{
test: /\.(png|jpg|gif)$/i,
use: [{
loader: 'url-loader',
options: {
limit: 8192
}
}]
},
{
test: /\.md$/i,
use: 'raw-loader',
},
/* {
test: /\.(woff|woff2|eot|ttf|otf)$/,
use: [
'file-loader'
]
} */
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
fallback: {
child_process: false,
fs: false,
crypto: false,
net: false,
tls: false,
ws: false,
os: false,
path: false
}
},
output: {
libraryTarget: 'umd',
filename: 'index.js',
path: path.resolve(__dirname, 'dist'),
},
plugins: [{
apply: (compiler) => {
compiler.hooks.afterEmit.tap('AfterEmitPlugin', (compilation) => {
const file = './dist/index.js';
var data = fs.readFileSync(file); //read existing contents into data
//var fd = fs.openSync(file, 'w+');
var buffer = new Buffer(copyright);
fs.writeFileSync(file, buffer);
fs.appendFileSync(file, data);
var bufferEnd = new Buffer(`
tuval$core.ModuleLoader.FireModuleLoadedEvent('${manifest.application.name}', tuval$core['__APPS__']['${manifest.application.name}']);
`);
fs.appendFileSync(file, bufferEnd);
/* fs.appendFile('./dist/index.js', `
tuval$core.ModuleLoader.FireModuleLoadedEvent('${manifest.application.name}', tuval$core['__APPS__']['${manifest.application.name}']);
`, (err) => {
if (err) throw err;
console.log('The lyrics were updated!');
}); */
});
}
}
]
};
module.exports = [umdConfig /* webClientConfig */ /* umdConfig */ /* , umdWebProcess */ ];