fix(backend): server standalone backend plugins

This commit is contained in:
Ivan Shmidt
2020-06-17 09:54:28 +02:00
parent 17bda8b46e
commit f47782834d
7 changed files with 15 additions and 5 deletions
+5 -1
View File
@@ -182,7 +182,11 @@ export function createBackendConfig(
},
devtool: isDev ? 'cheap-module-eval-source-map' : 'source-map',
context: paths.targetPath,
entry: ['webpack/hot/poll?100', paths.targetEntry],
entry: [
'webpack/hot/poll?100',
paths.targetEntry,
...(paths.targetRunFile ? [paths.targetRunFile] : []),
],
resolve: {
extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx'],
mainFields: ['main:src', 'browser', 'module', 'main'],
+5
View File
@@ -48,10 +48,15 @@ export function resolveBundlingPaths(options: BundlingPathsOptions) {
}
}
// Backend plugin dev run file
const targetRunFile = paths.resolveTarget('src/run.ts');
const runFileExists = fs.pathExistsSync(targetRunFile);
return {
targetHtml,
targetPublic,
targetPath: paths.resolveTarget('.'),
targetRunFile: runFileExists ? targetRunFile : undefined,
targetDist: paths.resolveTarget('dist'),
targetAssets: paths.resolveTarget('assets'),
targetSrc: paths.resolveTarget('src'),