Build failed on astro.build
Hey! Thanks a lot for your work! I'd like to ask you for help - I've added preline to my astro-powered app, but it fails with error
ReferenceError: self is not defined
at Object.<anonymous> (/Users/alec/Code/Internal/Asgard Company/asgard_company_landing/node_modules/preline/dist/preline.js:2:224)
at Module._compile (node:internal/modules/cjs/loader:1112:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1166:10)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Module._load (node:internal/modules/cjs/loader:834:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:170:29)
at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:409:24)
at async nodeImport (file:///Users/alec/Code/Internal/Asgard%20Company/asgard_company_landing/node_modules/vite/dist/node/chunks/dep-4da11a5e.js:53516:21)
Node.js v18.4.0
make: *** [dev] Error 1
when I use import('preline'). How to fix it?
Hey Alexey, hope the issue has been resolved - apologize for such a delayed reply.
Our team tested out Preline UI with Astro and seems everything is working fine. In addition, we have recently added Installation Guides for Astro here https://preline.co/docs/frameworks-astro.html
Please let us know the status of the issue. Thanks!
Hey, @jahaganiev! Thanks a lot for your response, but there are some things i've found when tried to add preline to astro.
- I've moved
import preline from "preline/plugin.js";to astro.config.mjs - It is incorrect path
./assets/vendor/preline/dist/preline.jshere
// Layout.astro
<script is:inline src="./assets/vendor/preline/dist/preline.js"></script>
and i've changed to
<script is:inline src="node_modules/preline/dist/preline.js"></script>
and it works, but it looks ugly.
Hey @alec-c4 @jahaganiev have got the same issue here, docs aren't accurate. Your workaround above may not work in production btw
There are still errors with using Astro with TypeScript, but it will be resolved when #28 is completed.
There are still errors with using Astro with TypeScript, but it will be resolved when #28 is completed.
Noted, thanks for sharing!
Hey @alec-c4 - we've added a backlink to our docs for this workaround solution. Thanks!