Skip to content

Pass features map down to BTR #466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ npm-debug.log
yarn.lock
/test-app/package-lock.json
/test-app/.dojorc
.vscode/
2 changes: 1 addition & 1 deletion src/base.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -676,5 +676,5 @@
}
};

return config as webpack.Configuration;
return config;

Check warning on line 679 in src/base.config.ts

View check run for this annotation

Codecov / codecov/patch

src/base.config.ts#L679

Added line #L679 was not covered by tests
}
6 changes: 5 additions & 1 deletion src/dev.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ window['${libraryName}'].base = '${base}'</script>`,
baseUrl: base,
scope: libraryName,
onDemand: Boolean(args.serve && args.watch),
cacheOptions: { ...cacheOptions, invalidates: [] }
cacheOptions: { ...cacheOptions, invalidates: [] },
features: {
...args.features,
NODE_ENV: config.mode
}
})
);
}
Expand Down
6 changes: 5 additions & 1 deletion src/dist.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ function webpackConfig(args: any): webpack.Configuration {
baseUrl: base,
scope: libraryName,
onDemand: Boolean(args.serve && args.watch),
cacheOptions: { ...cacheOptions, invalidates: [] }
cacheOptions: { ...cacheOptions, invalidates: [] },
features: {
...args.features,
NODE_ENV: config.mode
}
})
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ async function serve(configs: webpack.Configuration[], args: any, esbuild = fals
compiler: (compiler as any).compilers ? (compiler as any).compilers[0] : compiler,
entries: mainConfig.entry ? Object.keys(mainConfig.entry) : [],
outputPath: outputDir,
jsonpName
jsonpName,
features: args['features']
});
app.use(base, (req, res, next) => onDemandBtr.middleware(req, res, next));
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ describe('command', () => {

it('can run dev mode', () => {
const main = mockModule.getModuleUnderTest().default;
main.run(getMockHelper(), { mode: 'dev' }).then(() => {
return main.run(getMockHelper(), { mode: 'dev' }).then(() => {
assert.isTrue(mockDevConfig.called);
assert.isTrue(mockLogger.calledWith('stats', ['dev config']));
});
Expand Down