From 80903d38c0ab6e65db656fabcc7730d1206429c6 Mon Sep 17 00:00:00 2001 From: Anthony Gubler Date: Wed, 26 Sep 2018 15:36:38 +0100 Subject: [PATCH] Support main.tsx and make main.css optional --- src/base.config.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/base.config.ts b/src/base.config.ts index 429d51c4..ab337051 100644 --- a/src/base.config.ts +++ b/src/base.config.ts @@ -21,7 +21,10 @@ const basePath = process.cwd(); const srcPath = path.join(basePath, 'src'); const testPath = path.join(basePath, 'tests'); const allPaths = [srcPath, testPath]; -const mainEntryPath = path.join(srcPath, 'main.ts'); + +const isTsx = existsSync(path.join(srcPath, 'main.tsx')); +const mainEntryPath = path.join(srcPath, isTsx ? 'main.tsx' : 'main.ts'); +const mainCssPath = path.join(srcPath, 'main.css'); const indexHtmlPattern = /src\/index\.html$/; export const mainEntry = 'main'; @@ -273,7 +276,7 @@ export default function webpackConfigFactory(args: any): WebpackConfiguration { entry: { [mainEntry]: removeEmpty([ '@dojo/webpack-contrib/build-time-render/hasBuildTimeRender', - path.join(srcPath, 'main.css'), + existsSync(mainCssPath) ? mainCssPath : null, mainEntryPath ]) },