Comments (7)
Current solution is to use vite.config.mjs
and update it as follows:
import { defineConfig } from "vite";
import { default as laravel} from "laravel-vite-plugin";
import { MagicRegExpTransformPlugin } from "magic-regexp/transform";
export default defineConfig({
plugins: [
MagicRegExpTransformPlugin.vite(),
- laravel({
+ laravel.default({
input: ["resources/css/app.css", "resources/js/app.js"],
refresh: true,
}),
],
});
This is likely a bug in Vite when working with CJS context, or could be resolved by outputting native ESM from laravel-vite-plugin
.
from magic-regexp.
Released 0.3.0 with a workaround - let me know how it goes.
from magic-regexp.
Glad you figured this out, but unfortunately the (I'm assuming temporary) solution isn't ideal. Using .mjs
for vite config will break the types and everything related. Also I'm not using the official vite plugin yet and this wouldn't work with that ( given the initial repro which was based off that ).
So I guess we have to wait for a possible (unintended) Vite change in the future that fixes this issue ?
Is there no way to use this library in a normal TS/JS/Vue app ? Does it needs a transformer to work?
from magic-regexp.
No, it doesn't need the transformer to work as a library, just to compile to native RegExp. Using .mjs
shouldn't break anything type related unless you're using typescript within your config... Have you tried it?
from magic-regexp.
You can also set "type": "module"
in your package.json
to continue using a .ts
vite config file.
from magic-regexp.
No, it doesn't need the transformer to work as a library, just to compile to native RegExp. Using
.mjs
shouldn't break anything type related unless you're using typescript within your config... Have you tried it?
Yeah I did try .mjs
but my types broke in my SFCs.
You can also set
"type": "module"
in yourpackage.json
to continue using a.ts
vite config file.
I tried that as well but the whole dev
stopped working with tons of errors.
I guess the only way to use this, is to have it decoupled from my vite/ts app and basically compile the regexes manually and copy them over to any place where I use them
from magic-regexp.
If you give me an example of your code, I can probably help resolve.
I'm guessing you might have a /// <reference
at the top of your vite.config
file. If so, just copy that to another TS file in your project and you can then rename your config file .mjs
.
from magic-regexp.
Related Issues (20)
- $ Character gets escaped twice HOT 2
- `createRegExp` not sanitising strings (in type) HOT 1
- Very low contrast
- Incorrect open graph image HOT 1
- 500 - If you want to use `GithubLink` component, you must specify: `owner`, `repo` and `branch`.
- how do i recreate a password requirements regex? HOT 5
- No "exports" main defined in ....\.pnpm\[email protected]\node_modules\estree-walker\package.json HOT 3
- Lazy quantifier HOT 1
- not.word is not defined HOT 1
- Why is `MagicRegExpMatchArray` typed with `string | undefined`? HOT 3
- Infer the literals used in the type of the groups HOT 10
- Allow for custom regex, and clarifying the usage of `anyOf()` HOT 7
- Library blocks Typescript compilation HOT 2
- Action Required: Fix Renovate Configuration
- Documentation site is down HOT 1
- Can I rework docs using Nuxt UI Pro HOT 4
- Maige Usage
- Support match everything in preset inputs
- `Predefined Input can not be assigned to InputSource` when using with TypeScript < 4.7 HOT 6
- performance testing HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from magic-regexp.