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 {LionButton} from "../../../../node_modules/@lion/button/index.js";
|
||||||
import {SlotMixin} from "../../../../node_modules/@lion/core/src/SlotMixin.js";
|
import {SlotMixin} from "../../../../node_modules/@lion/core/src/SlotMixin.js";
|
||||||
import {Et2InputWidget} from "../Et2InputWidget/Et2InputWidget";
|
import {Et2InputWidget} from "../Et2InputWidget/Et2InputWidget";
|
||||||
|
@ -23,6 +23,18 @@ rimraf.sync('./chunks/');
|
|||||||
// Turn on minification
|
// Turn on minification
|
||||||
const do_minify = false;
|
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 = {
|
const config = {
|
||||||
treeshake: false,
|
treeshake: false,
|
||||||
input: {
|
input: {
|
||||||
@ -58,13 +70,18 @@ const config = {
|
|||||||
},
|
},
|
||||||
plugins: [{
|
plugins: [{
|
||||||
resolveId (id, parentId) {
|
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)
|
if (!parentId || parentId.indexOf(path.sep + 'node_modules' + path.sep) !== -1)
|
||||||
{
|
{
|
||||||
return;
|
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 {
|
try {
|
||||||
readFileSync(tsPath);
|
readFileSync(tsPath);
|
||||||
console.warn(id + " is a TS file loaded with wrong extension. Remove the extension on the import in " + parentId);
|
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