-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhtml.assets.js
More file actions
29 lines (24 loc) · 1.31 KB
/
Copy pathhtml.assets.js
File metadata and controls
29 lines (24 loc) · 1.31 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
const path = require('path');
// Single source of truth for which root-level html/ assets ship into a built
// sample. The example init.js files are copied raw (never bundled) and loaded
// as native ES modules, so anything they import at runtime — e.g.
// editorFallbackNotice.js — must be physically present in the output. Listing
// the rule here (instead of enumerating each file in webpack.samples.js) means
// a new shared helper ships automatically rather than silently 404-ing, which
// is the regression that broke build:samples in RDFORMS-163.
const htmlDir = path.resolve(__dirname, 'html');
// Root-level html/ scripts the built samples must NOT ship: these are injected
// only by the dev servers (webpack.dev.js / webpack.dev-all.js) as page chrome
// — the "← Examples" back link + flavor label, and the vanilla CSS on/off
// toggle. No sample page references them, so copying them would be dead weight.
const devOnlyRootScripts = ['exampleNav.js', 'vanillaCssToggle.js'];
// The copy rule the samples build applies for shared root-level scripts:
// every html/*.js except the dev-only chrome above.
const sharedRootScripts = {
from: '*.js',
context: htmlDir,
globOptions: {
ignore: devOnlyRootScripts.map((name) => `**/${name}`),
},
};
module.exports = { htmlDir, devOnlyRootScripts, sharedRootScripts };