Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 92d6fae

Browse files
committedMay 12, 2021
Pass features map down to BTR
1 parent 8b0e05e commit 92d6fae

File tree

7 files changed

+13
-9
lines changed

7 files changed

+13
-9
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ npm-debug.log
66
yarn.lock
77
/test-app/package-lock.json
88
/test-app/.dojorc
9+
.vscode/

‎src/base.config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export class InsertScriptPlugin {
199199
}
200200
}
201201

202-
export default function webpackConfigFactory(args: any): webpack.Configuration {
202+
export default function webpackConfigFactory(args: any): { config: webpack.Configuration; features: any } {
203203
tsnode.register({ transpileOnly: true });
204204
const isLegacy = args.legacy;
205205
const experimental = args.experimental || {};
@@ -676,5 +676,5 @@ export default function webpackConfigFactory(args: any): webpack.Configuration {
676676
}
677677
};
678678

679-
return config as webpack.Configuration;
679+
return { config, features };
680680
}

‎src/base.test.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import ExternalLoaderPlugin from '@dojo/webpack-contrib/external-loader-plugin/E
55
const WrapperPlugin = require('wrapper-webpack-plugin');
66

77
function webpackConfig(args: any): webpack.Configuration {
8-
const config = baseConfigFactory(args);
8+
const { config } = baseConfigFactory(args);
99
const { plugins, module } = config;
1010
const externals: any[] = (config.externals as any[]) || [];
1111

‎src/dev.config.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function webpackConfig(args: any): webpack.Configuration {
2727
const base = args.target === 'electron' ? './' : args.base || '/';
2828

2929
const basePath = process.cwd();
30-
const config = baseConfigFactory(args);
30+
const { config, features } = baseConfigFactory(args);
3131
const manifest: WebAppManifest = args.pwa && args.pwa.manifest;
3232
const { plugins, output, module } = config;
3333
const outputPath = path.join(output!.path!, 'dev');
@@ -131,7 +131,8 @@ window['${libraryName}'].base = '${base}'</script>`,
131131
baseUrl: base,
132132
scope: libraryName,
133133
onDemand: Boolean(args.serve && args.watch),
134-
cacheOptions: { ...cacheOptions, invalidates: [] }
134+
cacheOptions: { ...cacheOptions, invalidates: [] },
135+
features
135136
})
136137
);
137138
}

‎src/dist.config.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ All rights reserved
3434
function webpackConfig(args: any): webpack.Configuration {
3535
const basePath = process.cwd();
3636
const base = args.target === 'electron' ? './' : args.base || '/';
37-
const config = baseConfigFactory(args);
37+
const { config, features } = baseConfigFactory(args);
3838
const manifest: WebAppManifest = args.pwa && args.pwa.manifest;
3939
const { plugins, output } = config;
4040
const outputPath = path.join(output!.path!, 'dist');
@@ -156,7 +156,8 @@ function webpackConfig(args: any): webpack.Configuration {
156156
baseUrl: base,
157157
scope: libraryName,
158158
onDemand: Boolean(args.serve && args.watch),
159-
cacheOptions: { ...cacheOptions, invalidates: [] }
159+
cacheOptions: { ...cacheOptions, invalidates: [] },
160+
features
160161
})
161162
);
162163
}

‎src/main.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ async function serve(configs: webpack.Configuration[], args: any, esbuild = fals
196196
compiler: (compiler as any).compilers ? (compiler as any).compilers[0] : compiler,
197197
entries: mainConfig.entry ? Object.keys(mainConfig.entry) : [],
198198
outputPath: outputDir,
199-
jsonpName
199+
jsonpName,
200+
features: args['features']
200201
});
201202
app.use(base, (req, res, next) => onDemandBtr.middleware(req, res, next));
202203
}

‎tests/unit/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ describe('command', () => {
131131

132132
it('can run dev mode', () => {
133133
const main = mockModule.getModuleUnderTest().default;
134-
main.run(getMockHelper(), { mode: 'dev' }).then(() => {
134+
return main.run(getMockHelper(), { mode: 'dev' }).then(() => {
135135
assert.isTrue(mockDevConfig.called);
136136
assert.isTrue(mockLogger.calledWith('stats', ['dev config']));
137137
});

0 commit comments

Comments
 (0)
Please sign in to comment.