@companion-module/tools 2.7.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,82 +0,0 @@
1
- const path = require('path')
2
-
3
- module.exports = async (env) => {
4
- if (!env.ROOT) throw new Error(`Missing ROOT`)
5
- if (!env.MODULETYPE) throw new Error(`Missing MODULETYPE`)
6
-
7
- const pkgJson = require(path.join(env.ROOT, 'package.json'))
8
-
9
- if (!pkgJson.main) throw new Error(`Missing main in package.json`)
10
-
11
- let webpackExt = {}
12
- try {
13
- webpackExt = require(path.join(env.ROOT, 'build-config.cjs'))
14
-
15
- console.log('Found additional webpack configuration')
16
- } catch (e) {
17
- // Ignore
18
- }
19
-
20
- let externalsExt = []
21
- if (Array.isArray(webpackExt.externals)) externalsExt = webpackExt.externals
22
- else if (webpackExt.externals) externalsExt = [webpackExt.externals]
23
-
24
- return {
25
- entry: {
26
- main: './' + pkgJson.main, // path.join(frameworkDir, 'dist/entrypoint.js'),
27
- // Allow for custom entrypoints
28
- ...webpackExt.entry,
29
- },
30
- mode: env.dev ? 'development' : 'production',
31
- output:
32
- env.MODULETYPE === 'connection'
33
- ? {
34
- path: path.resolve(env.ROOT, 'pkg'),
35
- }
36
- : {
37
- path: path.resolve(env.ROOT, 'pkg'),
38
- filename: 'main.js',
39
- library: {
40
- type: 'commonjs2',
41
- // Avoid producing a double default in the bundle
42
- export: 'default',
43
- },
44
- },
45
- context: path.resolve(env.ROOT, '.'),
46
- target: 'node',
47
- externals: [
48
- // Allow for custom externals
49
- ...externalsExt,
50
- ],
51
- experiments: {
52
- topLevelAwait: true,
53
- },
54
- optimization: {
55
- minimize: !webpackExt.disableMinifier,
56
- },
57
- module: {
58
- rules: [
59
- // {
60
- // test: /\.json$/,
61
- // type: 'asset/source',
62
- // },
63
- // {
64
- // test: /BUILD$/,
65
- // type: 'asset/resource',
66
- // generator: {
67
- // filename: 'BUILD',
68
- // },
69
- // },
70
- ],
71
- },
72
- plugins: [
73
- // Let modules define additional plugins. Hopefully this won't conflict with anything we add
74
- ...(webpackExt.plugins || []),
75
- ],
76
- node: webpackExt.useOriginalStructureDirname
77
- ? {
78
- __dirname: true,
79
- }
80
- : undefined,
81
- }
82
- }