diff --git a/lib/defaultModules/useScope.js b/lib/defaultModules/useScope.js index 18628aae..2d1ec238 100644 --- a/lib/defaultModules/useScope.js +++ b/lib/defaultModules/useScope.js @@ -1,3 +1 @@ -import '../../src/entry.mjs'; - export default () => {}; diff --git a/lib/makeWebpackConfig.js b/lib/makeWebpackConfig.js index 8a532d55..11d1eca5 100644 --- a/lib/makeWebpackConfig.js +++ b/lib/makeWebpackConfig.js @@ -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', @@ -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 ), diff --git a/src/entry.mjs b/src/entry.mjs deleted file mode 100644 index 638f1bb0..00000000 --- a/src/entry.mjs +++ /dev/null @@ -1,7 +0,0 @@ -let imported = false; - -if (!imported) { - imported = true; - // eslint-disable-next-line import/no-unresolved - import('__PLAYROOM_ALIAS__ENTRY__'); -} diff --git a/src/frame.js b/src/frame.js index acd630ad..470b81da 100644 --- a/src/frame.js +++ b/src/frame.js @@ -1,5 +1,3 @@ -import './entry.mjs'; - import { renderElement } from './render'; import Frame from './Playroom/Frame'; diff --git a/src/index.js b/src/index.js index ddc2ef7c..4bd28845 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,3 @@ -import './entry.mjs'; - import { renderElement } from './render'; import Playroom from './Playroom/Playroom'; import { StoreProvider } from './StoreContext/StoreContext'; diff --git a/src/preview.js b/src/preview.js index c617c5a0..efae4509 100644 --- a/src/preview.js +++ b/src/preview.js @@ -1,5 +1,3 @@ -import './entry.mjs'; - import { renderElement } from './render'; import Preview from './Playroom/Preview';