Skip to content

Commit d5cdbd6

Browse files
committedMay 6, 2024
Bruk env variabel istedenfor plugin
1 parent 1b38583 commit d5cdbd6

File tree

7 files changed

+11
-45
lines changed

7 files changed

+11
-45
lines changed
 

‎bun.lockb

-520 Bytes
Binary file not shown.

‎packages/internarbeidsflate-decorator-v3/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"scripts": {
1919
"dev": "bunx --bun vite",
20-
"dev:fullscreen": "cross-env INTERNARBEIDSFLATE_DECORATOR_HTML_PATH='src/wrapper/fullscreen/index-fullscreen.html' bunx --bun vite",
20+
"dev:fullscreen": "VITE_DECORATOR_MODE=fullscreen bunx --bun vite",
2121
"build": "bunx --bun vite build",
2222
"build:watch": "bunx --bun vite build --watch",
2323
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
@@ -34,7 +34,6 @@
3434
"@vitejs/plugin-react": "^4.2.1",
3535
"autoprefixer": "^10.4.19",
3636
"concurrently": "^8.2.2",
37-
"cross-env": "^7.0.3",
3837
"eslint": "^8.57.0",
3938
"eslint-plugin-react-hooks": "^4.6.0",
4039
"eslint-plugin-react-refresh": "^0.4.6",

‎packages/internarbeidsflate-decorator-v3/src/wrapper/fullscreen/FullScreenWrapper.tsx ‎packages/internarbeidsflate-decorator-v3/src/wrapper/FullScreenWrapper.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import Decorator from '../../App';
2+
import Decorator from '../App';
33

44
const FullScreenWrapper = () => {
55
// En minimal Decorator som viser en fullskjermvisning av applikasjonen

‎packages/internarbeidsflate-decorator-v3/src/wrapper/fullscreen/fullScreen.tsx

-9
This file was deleted.

‎packages/internarbeidsflate-decorator-v3/src/wrapper/fullscreen/index-fullscreen.html

-13
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import React from 'react'
2-
import ReactDOM from 'react-dom/client'
3-
import Wrapper from './Wrapper'
1+
import React from 'react';
2+
import ReactDOM from 'react-dom/client';
3+
import Wrapper from './Wrapper';
4+
import FullScreenWrapper from './FullScreenWrapper';
5+
46

57
ReactDOM.createRoot(document.getElementById('root')!).render(
68
<React.StrictMode>
7-
<Wrapper />
8-
</React.StrictMode>,
9-
)
9+
{import.meta.env.VITE_DECORATOR_MODE === 'fullscreen' ? <FullScreenWrapper /> : <Wrapper />}
10+
</React.StrictMode>
11+
);

‎packages/internarbeidsflate-decorator-v3/vite.config.ts

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,10 @@
11
import { defineConfig } from 'vite';
2-
import { readFileSync } from 'fs';
3-
import { resolve } from 'path';
42
import react from '@vitejs/plugin-react';
53

64

75
export default defineConfig({
86
plugins: [
9-
react(),
10-
// Plugin som velger hvilken html-fil som skal brukes av dev-serveren
11-
{
12-
name: 'html-transform',
13-
transformIndexHtml: {
14-
order: 'pre',
15-
handler() {
16-
const htmlPath = process.env.INTERNARBEIDSFLATE_DECORATOR_HTML_PATH || 'index.html';
17-
return readFileSync(resolve(__dirname, htmlPath), 'utf-8');
18-
}
19-
}
20-
}
7+
react()
218
],
229
build: {
2310
cssMinify: true,

0 commit comments

Comments
 (0)