Skip to content

Commit 5d1476e

Browse files
hiroppyevilebottnawi
authored andcommitted
fix(example/util): use path.resolve (#1678)
fixes #1428
1 parent bf99c26 commit 5d1476e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

examples/util.js

+13
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ const webpack = require('webpack');
1111
module.exports = {
1212
setup(config) {
1313
const defaults = { mode: 'development', plugins: [], devServer: {} };
14+
15+
if (config.entry) {
16+
if (typeof config.entry === 'string') {
17+
config.entry = path.resolve(config.entry);
18+
} else if (Array.isArray(config.entry)) {
19+
config.entry = config.entry.map((entry) => path.resolve(entry));
20+
} else if (typeof config.entry === 'object') {
21+
Object.entries(config.entry).forEach(([key, value]) => {
22+
config.entry[key] = path.resolve(value);
23+
});
24+
}
25+
}
26+
1427
const result = Object.assign(defaults, config);
1528
const before = function before(app) {
1629
app.get('/.assets/*', (req, res) => {

0 commit comments

Comments
 (0)