forked from snyk/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.js
74 lines (73 loc) · 1.95 KB
/
webpack.common.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
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
module.exports = {
entry: './src/cli/index.ts',
target: 'node10',
output: {
clean: true,
path: path.resolve(__dirname, 'dist/cli/'),
filename: 'index.js',
library: {
name: 'snyk',
type: 'umd',
},
},
node: false, // don't mock node modules
plugins: [
new CopyPlugin({
patterns: [
// All of these plugins rely on a init.gradle or similar file in a specific location
// We should upgrade those npm packages to statically load these, instead of relying on a file location
{
from: 'node_modules/@snyk/java-call-graph-builder/bin/init.gradle',
to: '../bin',
},
{
from: 'node_modules/snyk-gradle-plugin/lib/init.gradle',
to: '../lib',
},
{
from: 'node_modules/snyk-python-plugin/pysrc/',
to: '../../pysrc/',
},
{
from: 'node_modules/@snyk/snyk-hex-plugin/elixirsrc/',
to: '../elixirsrc/',
},
{
from: 'node_modules/snyk-sbt-plugin/scala/',
to: '../scala/',
},
{
from: 'node_modules/snyk-go-plugin/gosrc/',
to: '../gosrc/',
},
{
from:
'node_modules/@snyk/java-call-graph-builder/config.default.json',
to: '../',
},
],
}),
],
module: {
rules: [
{
test: /\.ts$/i,
loader: 'ts-loader',
exclude: ['/node_modules'],
},
{
// `./node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node` is a binary file introduced
// by snyk-docker-plugin -> docker-modem@3
test: /ssh2\/lib\/protocol\/crypto\/build\/Release\/sshcrypto\.node/i,
type: 'asset/resource',
},
],
},
resolve: {
extensions: ['.ts', '.js', '.json'],
modules: ['packages', 'node_modules'],
},
externals: {},
};