-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.app.js
65 lines (58 loc) · 1.56 KB
/
webpack.config.app.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
const path = require('path')
const AppRootPath = require('app-root-path').path
const AppPackage = require(path.resolve(AppRootPath, 'package.json'))
const OUTPUT_PATH = path.resolve(__dirname, './www/js')
console.log('Output Path: ', OUTPUT_PATH)
const module_resolve = require('resolve')
if (AppPackage.name !== '@things-factory/shell') {
try {
let pathName = module_resolve.sync('@things-factory/shell', {
basedir: process.cwd()
})
var ShellModulePath = path.resolve(pathName, '../..')
var NodeModulePath = path.resolve(pathName, '../../../..')
} catch (e) {
throw new Exception('@things-factory/shell module not found.', e)
}
} else {
var ShellModulePath = path.resolve(__dirname)
var NodeModulePath = path.resolve(__dirname, 'node_modules')
}
console.log('FactoryShell Module Path', ShellModulePath)
console.log('Extern Module Path', NodeModulePath)
module.exports = {
mode: 'production',
entry: {
index: [path.resolve(__dirname, 'www', 'js', '_index.js')]
},
resolve: {
modules: [NodeModulePath]
},
resolveLoader: {
modules: [path.resolve(ShellModulePath, 'web-loaders'), NodeModulePath]
},
externals: {
'@hatiolab/things-scene': 'scene'
},
output: {
path: OUTPUT_PATH
},
optimization: {
minimize: false
},
module: {
rules: [
{
test: /native-importer.import$/,
use: {
loader: 'things-factory-native-loader',
options: {
module_path: NodeModulePath
}
}
}
]
},
plugins: [],
devtool: 'cheap-module-source-map'
}