forked from reggi/node-to-deno
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
40 lines (37 loc) · 878 Bytes
/
webpack.config.js
File metadata and controls
40 lines (37 loc) · 878 Bytes
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
const { zipObject } = require('lodash');
const nodeExternals = require('webpack-node-externals');
const webpack = require('webpack')
const pkg = require('./package.json')
const entry = {
...pkg.deno,
"path-browserify": "./deno_modules/path.js",
}
const hoist = (key, dep) => {
const data = {
import: `import ${key} from '${dep}'`,
assignment: key
}
return `${key};\n// hoist-for-deno-webpack: import ${key} from '${dep}'`
}
module.exports = {
entry: zipObject(Object.values(entry), Object.keys(entry)),
mode: "none",
output: {
filename: '[name]',
path: __dirname,
libraryTarget: 'commonjs-module'
},
externals: [nodeExternals()],
externals: {
"path": hoist('path', './path'),
},
resolve: {
extensions: [".js"],
},
plugins: [
new webpack.BannerPlugin({
banner: '// @ts-nocheck',
raw: true
}),
]
}