webpack.config.js
4.41 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
const path = require('path');
const jsdoc = require('jsdoc-webpack-plugin');
const copy = require('copy-webpack-plugin');
module.exports = [
{
name: "doc",
mode: "development",
entry: {},
plugins: [
new jsdoc({
conf: 'docs/components.conf.json',
destination: 'docs/components',
template: 'docs/arcs',
}),
]
},
{
name: "deps",
mode: "production",
entry: {},
plugins: [
new copy({
patterns: [
{ from: 'node_modules/arcsjs/build/arcs.js', to: '../engine/arcs.js'},
{ from: 'node_modules/jsqr/dist/jsQR.js', to: '../deps/jsqr/jsQR.js'},
{ from: 'node_modules/three/build/three.module.js', to: '../deps/three.js/index.js'},
{
from: 'node_modules/three/examples/jsm/loaders/OBJLoader.js',
to: '../deps/objloader/index.js',
transform: function(content, path) {
return Buffer.from(content.toString().replace(
'../../../build/three.module.js',
'../three.js/index.js'
));
}
},
{
from: 'node_modules/three/examples/jsm/loaders/MTLLoader.js',
to: '../deps/mtlloader/index.js',
transform: function(content, path) {
return Buffer.from(content.toString().replace(
'../../../build/three.module.js',
'../three.js/index.js'
));
}
},
{
from: 'node_modules/three/examples/jsm/loaders/DDSLoader.js',
to: '../deps/ddsloader/index.js',
transform: function(content, path) {
return Buffer.from(content.toString().replace(
'../../../build/three.module.js',
'../three.js/index.js'
));
}
},
{
from: 'node_modules/three/examples/jsm/webxr/ARButton.js',
to: '../deps/three.js/ARButton.js',
transform: function(content, path) {
return Buffer.from(content.toString().replace(
'../../../build/three.module.js',
'./index.js'
));
}
},
{
from: 'node_modules/js-aruco/src/aruco.js',
to: '../deps/aruco/index.js',
transform: function(content, path) {
return Buffer.from(content.toString()
.replace(
"var CV = require('./cv');",
"import CV from '../cv/index.js';"
)
.replace(
"module.exports = AR;",
"export default AR;"
)
);
}
},
{
from: 'node_modules/js-aruco/src/cv.js',
to: '../deps/cv/index.js',
transform: function(content, path) {
return Buffer.from(content.toString()
.replace(
"module.exports = CV;",
"export default CV;"
)
);
}
},
// TODO put here also files for dep directory.
// can also prepend content and replace strings using the transform property!
]
}),
]
}
];