permafrost-dev / alpinejs-ray Goto Github PK
View Code? Open in Web Editor NEWDebug your Alpine.js code with Ray to fix problems faster
Home Page: https://permafrost.dev/open-source
License: MIT License
Debug your Alpine.js code with Ray to fix problems faster
Home Page: https://permafrost.dev/open-source
License: MIT License
Description
Unable to use alpinejs-ray via CDN shows the following error in the web inspector:
TypeError: Cannot read properties of undefined (reading 'randomUUID')
Steps To Reproduce
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://cdn.jsdelivr.net/npm/axios@latest/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/alpinejs-ray@2/dist/standalone.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/alpinejs@3/dist/cdn.min.js" defer></script>
</head>
<body>
<div x-data>
<button @click="$ray('hello from alpine')">Send to Ray</button>
</div>
</body>
</html>
Send to ray
Expected behavior
The web page should not have any errors and should communicate with Ray
Environment
Additional context
Setting up a project with alpinejs-ray installed via npm works correctly.
Describe the bug
When I add alpinejs-ray to an Alpine V3.2.3 project I get the following error in the console
alpine.js?id=a3692cc7446e217f9238:2 Uncaught TypeError: e.Alpine.addMagicProperty is not a function at Object.start (alpine.js?id=a3692cc7446e217f9238:2) at alpine.js?id=a3692cc7446e217f9238:2 at alpine.js?id=a3692cc7446e217f9238:2 at alpine.js?id=a3692cc7446e217f9238:2
Uncaught TypeError: Cannot read property 'parentElement' of undefined at Yn (alpine.js?id=a3692cc7446e217f9238:2) at alpine.js?id=a3692cc7446e217f9238:2
To Reproduce
Steps to reproduce the behavior:
create a new project with latest alpine js (v3.2.3 at this time) and alpinejs-ray
"dependencies": { "alpinejs": "^3.2.3", "alpinejs-ray": "^1.4.0", }
Add alpinejs-ray to your alpine config
import { Ray, ray } from 'node-ray/web';
import Alpine from 'alpinejs';
import AlpineRayPlugin from 'alpinejs-ray';
window.alpineRayConfig = {
logComponentsInit: true,
logCustomEvents: false,
interceptErrors: true,
interceptSpruce: true,
};
window.ray = ray;
window.Ray = Ray;
window.axios = require('axios');
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
window.Alpine = Alpine;
window.AlpineRayPlugin = AlpineRayPlugin;
window.AlpineRayPlugin.init();
window.AlpineRayPlugin.start();
Alpine.start()
Start you webserver and load a page including the alpinejs refference
See error
alpine.js?id=a3692cc7446e217f9238:2 Uncaught TypeError: e.Alpine.addMagicProperty is not a function at Object.start (alpine.js?id=a3692cc7446e217f9238:2) at alpine.js?id=a3692cc7446e217f9238:2 at alpine.js?id=a3692cc7446e217f9238:2 at alpine.js?id=a3692cc7446e217f9238:2
Expected behavior
When adding alpinejs-ray to an alpine project the plugin should be loaded successfully
Screenshots
None
Environment (please complete the following information):
Intercept all errors from alpinejs that start with "Alpine Error: " and send them to Ray instead.
Reference: alpinejs/src/utils.js#L68
@HugoDF any help or insight on this would be appreciated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.