forked from extern/egroupware
fix: node_modules resolutions
This commit is contained in:
parent
4218b132f9
commit
2526b0460e
@ -9,7 +9,7 @@
|
||||
*/
|
||||
|
||||
|
||||
import {css, html} from "../../../../node_modules/@lion/core/index.js";
|
||||
import {css, html} from "@lion/core";
|
||||
import {LionButton} from "../../../../node_modules/@lion/button/index.js";
|
||||
import {SlotMixin} from "../../../../node_modules/@lion/core/src/SlotMixin.js";
|
||||
import {Et2InputWidget} from "../Et2InputWidget/Et2InputWidget";
|
||||
|
@ -23,6 +23,18 @@ rimraf.sync('./chunks/');
|
||||
// Turn on minification
|
||||
const do_minify = false;
|
||||
|
||||
function isBareSpecifier (id) {
|
||||
if (id.startsWith("./") || id.startsWith("../") || id.startsWith("/"))
|
||||
return false;
|
||||
try {
|
||||
new URL(id);
|
||||
return false;
|
||||
}
|
||||
catch {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
const config = {
|
||||
treeshake: false,
|
||||
input: {
|
||||
@ -58,13 +70,18 @@ const config = {
|
||||
},
|
||||
plugins: [{
|
||||
resolveId (id, parentId) {
|
||||
// Delegate bare specifiers to node_modules resolver
|
||||
if (isBareSpecifier(id))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!parentId || parentId.indexOf(path.sep + 'node_modules' + path.sep) !== -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(id.endsWith(".js"))
|
||||
if (id.endsWith(".js"))
|
||||
{
|
||||
const tsPath =path.resolve(path.dirname(parentId), id.slice(0,-3) + '.ts');
|
||||
const tsPath = path.resolve(path.dirname(parentId), id.slice(0,-3) + '.ts');
|
||||
try {
|
||||
readFileSync(tsPath);
|
||||
console.warn(id + " is a TS file loaded with wrong extension. Remove the extension on the import in " + parentId);
|
||||
|
Loading…
Reference in New Issue
Block a user