Unable to resolve path aliases
GHNewbiee opened this issue · 2 comments
GHNewbiee commented
reboost: 0.16.1
reboost.js
const { start } = require('reboost');
start({
entries: [
['./src/components/my-element/index.js', './public/dist/index.js']
],
contentServer: {
root: './public',
open: true
},
resolve: {
alias: {
Icons: './public/dist/assets/icons'
}
}
});
index.js
import { a, b, c } from 'Icons/icons.js';
...
Unfortunately, it fails displaying Unable to resolve path "Icons/icons" of ".../index.js
But, by using
import { a, b, c } from '../../../public/dist/assets/icons/icons.js';
it works as expected.
Do I miss something? Are there any prerequisites?
sarsamurmu commented
It's a bug in Reboost. Aliases are just getting substituted, without fixing relative paths. So basically it's now turning this
import 'Icons/icons.js';
into
import './public/dist/assets/icons/icons.js';
For temporary fix you can pass absolute paths in the option, like this
const path = require('path');
const { start } = require('reboost');
start({
resolve: {
alias: {
Icons: path.join(__dirname, './public/dist/assets/icons')
}
}
});
This should be fixed in the next release.
sarsamurmu commented
Fixed in v0.16.2