-
Notifications
You must be signed in to change notification settings - Fork 8
/
webpack.config.js
56 lines (48 loc) · 1.15 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
// Note this only includes basic configuration for development mode.
// For a more comprehensive configuration check:
// https://github.com/fable-compiler/webpack-config-template
const webpack = require('webpack');
var CONFIG = {
fsharpEntry: './src/Main.fs.js',
outputDir: './dist/js',
}
var path = require("path");
var fs = require('fs');
console.log("Bundling for cli...");
var resolve = path.resolve;
var nodeModulesDir = resolve("node_modules");
var nodeExternals = {};
fs.readdirSync(nodeModulesDir)
.filter(function(x) {
return ['.bin'].indexOf(x) === -1;
})
.forEach(function(mod) {
nodeExternals[mod] = 'commonjs ' + mod;
});
module.exports = {
target: "node",
entry: CONFIG.fsharpEntry,
externals: {
typescript: "commonjs typescript",
yargs: "commonjs yargs",
'yargs-parser': "commonjs yargs-parser"
},
output: {
path: path.join(__dirname, CONFIG.outputDir),
filename: 'ts2ocaml.js'
},
module: {
rules: [
{
resourceQuery: /raw/,
type: 'asset/source'
}
]
},
plugins: [
new webpack.BannerPlugin({
banner: "#!/usr/bin/env node",
raw: true
})
]
};