Skip to content

Commit

Permalink
simplify custom entry
Browse files Browse the repository at this point in the history
  • Loading branch information
mrm007 committed Feb 20, 2024
1 parent d32d505 commit 79bfc40
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 21 deletions.
2 changes: 0 additions & 2 deletions lib/defaultModules/useScope.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import '../../src/entry.mjs';

export default () => {};
12 changes: 6 additions & 6 deletions lib/makeWebpackConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@ module.exports = async (playroomConfig, options) => {
}

const staticTypes = await getStaticTypes(playroomConfig);
const commonEntry = playroomConfig.entry
? relativeResolve(playroomConfig.entry)
: require.resolve('./defaultModules/entry');

const ourConfig = {
mode: options.production ? 'production' : 'development',
entry: {
index: [require.resolve('../src/index.js')],
frame: [require.resolve('../src/frame.js')],
preview: [require.resolve('../src/preview.js')],
index: [commonEntry, require.resolve('../src/index.js')],
frame: [commonEntry, require.resolve('../src/frame.js')],
preview: [commonEntry, require.resolve('../src/preview.js')],
},
output: {
filename: '[name].[contenthash].js',
Expand All @@ -56,9 +59,6 @@ module.exports = async (playroomConfig, options) => {
},
extensions: ['.mjs', '.tsx', '.ts', '.jsx', '.js', '.json'],
alias: {
__PLAYROOM_ALIAS__ENTRY__: playroomConfig.entry
? relativeResolve(playroomConfig.entry)
: require.resolve('./defaultModules/entry'),
__PLAYROOM_ALIAS__COMPONENTS__: relativeResolve(
playroomConfig.components
),
Expand Down
7 changes: 0 additions & 7 deletions src/entry.mjs

This file was deleted.

2 changes: 0 additions & 2 deletions src/frame.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import './entry.mjs';

import { renderElement } from './render';
import Frame from './Playroom/Frame';

Expand Down
2 changes: 0 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import './entry.mjs';

import { renderElement } from './render';
import Playroom from './Playroom/Playroom';
import { StoreProvider } from './StoreContext/StoreContext';
Expand Down
2 changes: 0 additions & 2 deletions src/preview.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import './entry.mjs';

import { renderElement } from './render';
import Preview from './Playroom/Preview';

Expand Down

0 comments on commit 79bfc40

Please sign in to comment.