Skip to content

Commit

Permalink
refactor: Place entry files within src directory
Browse files Browse the repository at this point in the history
Align with Gutenberg project practices.
  • Loading branch information
dcalhoun committed Nov 18, 2024
1 parent ef1a854 commit cef11a2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.html → src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.jsx"></script>
<script type="module" src="/index.jsx"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion remote.html → src/remote.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/remote.jsx"></script>
<script type="module" src="/remote.jsx"></script>
</body>
</html>
2 changes: 2 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import react from '@vitejs/plugin-react';
export default defineConfig({
base: '',
build: {
outDir: '../dist',
target: 'esnext',
},
plugins: [react()],
root: 'src',
});
5 changes: 4 additions & 1 deletion vite.config.remote.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { resolve } from 'path';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { defaultRequestToExternal } from '@wordpress/dependency-extraction-webpack-plugin/lib/util';
Expand All @@ -6,13 +7,15 @@ import MagicString from 'magic-string';
export default defineConfig({
base: '',
build: {
outDir: '../dist',
rollupOptions: {
input: 'remote.html',
input: resolve(__dirname, 'src/remote.html'),
external: externalize,
},
target: 'esnext',
},
plugins: [react(), wordPressExternals()],
root: 'src',
});

function externalize(id) {
Expand Down

0 comments on commit cef11a2

Please sign in to comment.