Skip to content
This repository was archived by the owner on Aug 10, 2025. It is now read-only.

Commit 75a0743

Browse files
committed
feat: env-based notification
1 parent 3b7d27c commit 75a0743

File tree

4 files changed

+69
-17
lines changed

4 files changed

+69
-17
lines changed

resources/js/main.development.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom/client';
3+
import App from './App.tsx';
4+
import '../css/index.css';
5+
6+
const root = document.getElementById('root');
7+
const path = root?.dataset.path || '';
8+
9+
ReactDOM.createRoot(root!).render(
10+
<React.StrictMode>
11+
<App path={path} />
12+
</React.StrictMode>
13+
);

resources/js/main.production.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom/client';
3+
import App from './App.tsx';
4+
import '../css/index.css';
5+
6+
const root = document.getElementById('root');
7+
const path = root?.dataset.path || '';
8+
9+
ReactDOM.createRoot(root!).render(
10+
<App path={path} />
11+
);
Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
<?php include base_path('/vendor/luminarix/laravel-web-tinker/dist/index.html'); ?>
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<link rel="icon" href="{{ asset('vendor/web-tinker/img/favicon.png') }}" />
7+
<title>Tinker</title>
8+
</head>
9+
<body>
10+
<div id="root" data-path="/tinker"></div>
11+
@if(app()->environment('production'))
12+
<script src="{{ asset('vendor/web-tinker/production.js') }}"></script>
13+
@else
14+
<script src="{{ asset('vendor/web-tinker/development.js') }}"></script>
15+
@endif
16+
</body>
17+
</html>

vite.config.ts

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,33 @@ import react from "@vitejs/plugin-react";
44
import { viteStaticCopy } from "vite-plugin-static-copy";
55

66
export default defineConfig({
7-
plugins: [
8-
react(),
9-
viteStaticCopy({
10-
targets: [
11-
{
12-
src: "resources/img",
13-
dest: "",
14-
},
15-
],
16-
}),
17-
],
18-
base: "/vendor/web-tinker/",
19-
resolve: {
20-
alias: {
21-
"@": path.resolve(__dirname, "./resources/js"),
7+
plugins: [
8+
react(),
9+
viteStaticCopy({
10+
targets: [
11+
{
12+
src: "resources/img",
13+
dest: "",
2214
},
15+
],
16+
}),
17+
],
18+
base: "/vendor/web-tinker/",
19+
resolve: {
20+
alias: {
21+
"@": path.resolve(__dirname, "./resources/js"),
2322
},
24-
});
23+
},
24+
build: {
25+
outDir: "dist",
26+
rollupOptions: {
27+
input: {
28+
production: path.resolve(__dirname, "resources/js/main.production.tsx"),
29+
development: path.resolve(__dirname, "resources/js/main.development.tsx"),
30+
},
31+
output: {
32+
entryFileNames: "[name].js",
33+
},
34+
},
35+
},
36+
});

0 commit comments

Comments
 (0)