Co-authored-by: Max Sagan - Yieldbroker <max.sagan@yieldbroker.com>
This commit is contained in:
parent
21f642a6f9
commit
825190674c
@ -43,7 +43,7 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"alias": "platform",
|
"alias": "platform",
|
||||||
"description": "Target platform for the build, same as the Webpack target option.",
|
"description": "Target platform for the build, same as the Webpack target option.",
|
||||||
"enum": ["node", "web"],
|
"enum": ["node", "web", "webworker"],
|
||||||
"default": "web"
|
"default": "web"
|
||||||
},
|
},
|
||||||
"deleteOutputPath": {
|
"deleteOutputPath": {
|
||||||
|
|||||||
@ -36,7 +36,7 @@
|
|||||||
"target": {
|
"target": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Target platform for the build, same as the Webpack config option.",
|
"description": "Target platform for the build, same as the Webpack config option.",
|
||||||
"enum": ["node", "web"],
|
"enum": ["node", "web", "webworker"],
|
||||||
"default": "web"
|
"default": "web"
|
||||||
},
|
},
|
||||||
"skipFormat": {
|
"skipFormat": {
|
||||||
|
|||||||
@ -20,8 +20,8 @@ export function getWebpackConfig(
|
|||||||
): Configuration {
|
): Configuration {
|
||||||
const config: Configuration = {};
|
const config: Configuration = {};
|
||||||
const configure =
|
const configure =
|
||||||
options.target === 'node'
|
options.target === 'web'
|
||||||
? withNx()
|
? composePluginsSync(withNx(), withWeb())
|
||||||
: composePluginsSync(withNx(), withWeb());
|
: withNx();
|
||||||
return configure(config, { options, context });
|
return configure(config, { options, context });
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,7 +61,7 @@ export interface WebpackExecutorOptions {
|
|||||||
runtimeChunk?: boolean;
|
runtimeChunk?: boolean;
|
||||||
sourceMap?: boolean | 'hidden';
|
sourceMap?: boolean | 'hidden';
|
||||||
statsJson?: boolean;
|
statsJson?: boolean;
|
||||||
target?: 'node' | 'web';
|
target?: 'node' | 'web' | 'webworker';
|
||||||
transformers?: TransformerEntry[];
|
transformers?: TransformerEntry[];
|
||||||
tsConfig: string;
|
tsConfig: string;
|
||||||
vendorChunk?: boolean;
|
vendorChunk?: boolean;
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"alias": "platform",
|
"alias": "platform",
|
||||||
"description": "Target platform for the build, same as the Webpack target option.",
|
"description": "Target platform for the build, same as the Webpack target option.",
|
||||||
"enum": ["node", "web"],
|
"enum": ["node", "web", "webworker"],
|
||||||
"default": "web"
|
"default": "web"
|
||||||
},
|
},
|
||||||
"deleteOutputPath": {
|
"deleteOutputPath": {
|
||||||
|
|||||||
@ -7,7 +7,7 @@ export interface WebpackProjectGeneratorSchema {
|
|||||||
skipFormat?: boolean;
|
skipFormat?: boolean;
|
||||||
skipPackageJson?: boolean;
|
skipPackageJson?: boolean;
|
||||||
skipValidation?: boolean;
|
skipValidation?: boolean;
|
||||||
target?: 'node' | 'web';
|
target?: 'node' | 'web' | 'webworker';
|
||||||
webpackConfig?: string;
|
webpackConfig?: string;
|
||||||
babelConfig?: string;
|
babelConfig?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,7 +36,7 @@
|
|||||||
"target": {
|
"target": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Target platform for the build, same as the Webpack config option.",
|
"description": "Target platform for the build, same as the Webpack config option.",
|
||||||
"enum": ["node", "web"],
|
"enum": ["node", "web", "webworker"],
|
||||||
"default": "web"
|
"default": "web"
|
||||||
},
|
},
|
||||||
"skipFormat": {
|
"skipFormat": {
|
||||||
|
|||||||
@ -75,14 +75,14 @@ function addBuildTarget(tree: Tree, options: WebpackProjectGeneratorSchema) {
|
|||||||
buildOptions.babelUpwardRootMode = true;
|
buildOptions.babelUpwardRootMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.target === 'node') {
|
if (options.target === 'web') {
|
||||||
tree.write(
|
tree.write(
|
||||||
joinPathFragments(project.root, 'webpack.config.js'),
|
joinPathFragments(project.root, 'webpack.config.js'),
|
||||||
`
|
`
|
||||||
const { composePlugins, withNx } = require('@nx/webpack');
|
const { composePlugins, withNx, withWeb } = require('@nx/webpack');
|
||||||
|
|
||||||
// Nx plugins for webpack.
|
// Nx plugins for webpack.
|
||||||
module.exports = composePlugins(withNx(), (config) => {
|
module.exports = composePlugins(withNx(), withWeb(), (config) => {
|
||||||
// Update the webpack config as needed here.
|
// Update the webpack config as needed here.
|
||||||
// e.g. \`config.plugins.push(new MyPlugin())\`
|
// e.g. \`config.plugins.push(new MyPlugin())\`
|
||||||
return config;
|
return config;
|
||||||
@ -93,10 +93,10 @@ module.exports = composePlugins(withNx(), (config) => {
|
|||||||
tree.write(
|
tree.write(
|
||||||
joinPathFragments(project.root, 'webpack.config.js'),
|
joinPathFragments(project.root, 'webpack.config.js'),
|
||||||
`
|
`
|
||||||
const { composePlugins, withNx, withWeb } = require('@nx/webpack');
|
const { composePlugins, withNx } = require('@nx/webpack');
|
||||||
|
|
||||||
// Nx plugins for webpack.
|
// Nx plugins for webpack.
|
||||||
module.exports = composePlugins(withNx(), withWeb(), (config) => {
|
module.exports = composePlugins(withNx(), (config) => {
|
||||||
// Update the webpack config as needed here.
|
// Update the webpack config as needed here.
|
||||||
// e.g. \`config.plugins.push(new MyPlugin())\`
|
// e.g. \`config.plugins.push(new MyPlugin())\`
|
||||||
return config;
|
return config;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user