-
-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathwebpack.config.js
69 lines (65 loc) · 2.12 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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin')
const CleanWebpackPlugin = require("clean-webpack-plugin");
const outputDirectory = 'dist';
const tests = [
{name: 'fulladder', title: 'Full Adder'},
{name: 'serialadder', title: 'Serial Adder'},
{name: 'cycleadder', title: 'Accumulating Adder'},
{name: 'arithconst', title: 'Fused arithmetic with constants'},
{name: 'lfsr', title: 'Linear Feedback Shift Register'},
{name: 'sextium', title: 'Sextium III Processor'},
{name: 'rom', title: 'Async ROM'},
{name: 'ram', title: 'Simple RAM'},
{name: 'fsm', title: 'Finite State Machine'},
{name: 'gates', title: 'All available gates'},
{name: 'biggate', title: 'N-ary gates'},
{name: 'muxsparse', title: 'Sparse mux'},
{name: 'io', title: 'Input/Output types'},
{name: 'horner', title: 'Benchmark example'},
{name: 'latch', title: 'Level-triggered D-latch example'},
{name: 'warnings', title: 'Warnings example'}
];
module.exports = {
output: {
path: path.resolve(__dirname, outputDirectory),
filename: 'main.js',
library: 'digitaljs',
libraryTarget: 'umd',
umdNamedDefine: true,
globalObject: 'this'
},
entry: "./src/index.mjs",
devtool: "source-map",
module: {
rules: [
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},
{
test: /\.svg|\.png/,
type: 'asset'
},
{
test: require.resolve('jquery'),
loader: 'expose-loader',
options: {
exposes: ['$']
}
}
]
},
plugins: [
new CleanWebpackPlugin(),
].concat(tests.map(t => new HtmlWebpackPlugin({
title: t.title,
template: 'examples/template.html',
test: JSON.stringify(require('./examples/' + t.name + '.json')),
filename: 'test/' + t.name + '.html',
inject: 'head'
})))
}