-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/#73 use esm #114
Feature/#73 use esm #114
Conversation
@@ -1,2 +1,2 @@ | |||
import { unsafeHTML } from '@popeindustries/lit-html-server/directives/unsafe-html'; | |||
import { unsafeHTML } from '@popeindustries/lit-html-server/directives/unsafe-html.mjs'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukas-schardt .mjs?
return id.startsWith('.') | ||
? import(path.resolve(process.cwd(), id)) | ||
: import(path.resolve(process.cwd(), `./node_modules/${id}`)); | ||
console.log({ url: require.resolve(id) }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukas-schardt Is this log supposed to stay in here?
@@ -3,8 +3,7 @@ import { getSerializableConfig, getSettings, getManifest } from '../config.js'; | |||
import posthtml from 'posthtml'; | |||
import posthtmlInsertAt from 'posthtml-insert-at'; | |||
|
|||
import { InlineInject } from '../../decorators/service.js'; | |||
import ComponentLoader from '../loaders/component-loader.js'; | |||
import ComponentLoader from '../loaders/component-loader.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukas-schardt This is probably not a problem but there is some whitespace in front of the statement.
.eslintrc
Outdated
"rules": { | ||
"prettier/prettier": "error" | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 2021, | ||
"ecmaVersion": 13, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukas-schardt Can we use 2022 instead of 13? Who knows what 13 means
class LunaCache { | ||
async clear() { | ||
try { | ||
Object.keys(require.cache).forEach((key) => delete require.cache[require.resolve(key)]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukas-schardt I found some "left over" require statements
}); | ||
}; | ||
manifest.hooks.forEach(({ file }) => { | ||
const module = require(path.resolve(path.join(basePath, file))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukas-schardt I found some "left over" require statements
import ElementFactoryFactory from '../shared/element-factory'; | ||
import TemplateRenderer from "./template-renderer"; | ||
import ElementFactoryFactory from '../shared/element-factory.js'; | ||
import TemplateRenderer from "./template-renderer.js"; | ||
|
||
const ElementFactory = ElementFactoryFactory(TemplateRenderer); | ||
|
||
const stubs = async () => [{ | ||
sources: ['@webtides/element-js'], | ||
stub: require.resolve('./stubs/index.js'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukas-schardt I found some "left over" require statements
|
||
const ElementFactory = ElementFactoryFactory(TemplateRenderer); | ||
|
||
const stubs = async () => [{ | ||
sources: ['@webtides/element-js'], | ||
stub: require.resolve('./stubs/index.js'), | ||
}, { | ||
sources: ['lit-html/directives/unsafe-html'], | ||
sources: ['lit-html/directives/unsafe-html.js', 'lit-html/directives/unsafe-html'], | ||
stub: require.resolve('./stubs/unsafe-html.js'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukas-schardt I found some "left over" require statements
|
||
const ElementFactory = ElementFactoryFactory(TemplateRenderer); | ||
|
||
const stubs = async () => [{ | ||
sources: ['@webtides/element-js/src/renderer/vanilla'], | ||
sources: ['@webtides/element-js/src/renderer/vanilla', '@webtides/element-js/src/renderer/vanilla.js'], | ||
stub: require.resolve('./stubs/index.js'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukas-schardt I found some "left over" require statements
packages/renderer/src/lit/index.js
Outdated
import TemplateRenderer from "./template-renderer"; | ||
import ElementFactory from './element-factory.js'; | ||
import TemplateRenderer from "./template-renderer.js"; | ||
|
||
const stubs = async () => [{ | ||
sources: ['lit'], | ||
stub: require.resolve('./stubs/index.js'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukas-schardt I found some "left over" require statements
I'm trying to use the new version in some of my recent projects. I'm still running into some errors... This one for example: "The component with the tag name "undefined" has no ElementFactory" Also I had some trouble defining the factory. Would it be possible to set the factory by reference rather than just a string? |
I also tried to use this new version for the ocean-crm demo project. I'm running into some weird bugs. I'm not getting any error messages. The luna startup just stops before registering components and prints out a bunch of bundled code for one single imported file (but not all of it...) |
If I add some more logging: The component with the tag name "undefined" has no ElementFactory { I think this is the index page? Also the luna-renderer package is still "commonjs" and bundles a bunch of require stuff - is that supposed to be like that? |
and remove unused imports
a800c11
to
854f330
Compare
the tests are actually all green, but also somehow failing…
@lukas-schardt @quarkus I think this should be good now! Please have a look 😆 |
No description provided.