feat: auto alias for fleck
This commit is contained in:
parent
1f0bfce3ba
commit
8806d12d04
|
@ -7,6 +7,10 @@ const {
|
||||||
|
|
||||||
const R = require('./require');
|
const R = require('./require');
|
||||||
|
|
||||||
|
const {
|
||||||
|
FLECKS_ROOT = process.cwd(),
|
||||||
|
} = process.env;
|
||||||
|
|
||||||
const resolver = (source) => (path) => {
|
const resolver = (source) => (path) => {
|
||||||
// Does the file resolve as source?
|
// Does the file resolve as source?
|
||||||
try {
|
try {
|
||||||
|
@ -27,9 +31,12 @@ const resolver = (source) => (path) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = () => (neutrino) => {
|
module.exports = () => (neutrino) => {
|
||||||
const {packageJson: {files = []}, source} = neutrino.options;
|
const {packageJson: {name, files = []}, source} = neutrino.options;
|
||||||
// index is not taken for granted.
|
// index is not taken for granted.
|
||||||
neutrino.config.entryPoints.delete('index');
|
neutrino.config.entryPoints.delete('index');
|
||||||
|
// Alias this package.
|
||||||
|
neutrino.config.resolve.alias
|
||||||
|
.set(name, join(FLECKS_ROOT, 'src'));
|
||||||
// Calculate entry points from `files`.
|
// Calculate entry points from `files`.
|
||||||
files
|
files
|
||||||
.filter(resolver(source))
|
.filter(resolver(source))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user