Skip to content
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
3 changes: 3 additions & 0 deletions packages/build-plugin-lowcode/demo/component/build.lowcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ module.exports = {
},
],
],
chainWebpack(config, taskName) {

},
};
4 changes: 4 additions & 0 deletions packages/build-plugin-lowcode/src/config/user-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,8 @@ module.exports = [
}
},
},
{
name: 'chainWebpack',
validation: 'object',
},
];
14 changes: 13 additions & 1 deletion packages/build-plugin-lowcode/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ async function build(options, pluginOptions, execCompile) {
}),
);
const metaPathMap = {};
metaPaths.forEach((item) => {
metaPaths.forEach((item) => {
metaPathMap[path.basename(item).replace(path.extname(item), '')] = item;
// metaPathMap[item.slice(item.lastIndexOf('/') + 1, item.lastIndexOf('.'))] = item;
});
Expand Down Expand Up @@ -509,6 +509,8 @@ async function start(options, pluginOptions) {
if (baseLibrary === 'rax') {
config.module.rule('scss').use('rpx-loader').loader('rpx-loader').before('css-loader');
}
const chain = options.context.userConfig.chainWebpack;
if(chain) chain(config, 'lowcode-dev');
});
}

Expand Down Expand Up @@ -709,6 +711,9 @@ async function bundleMetaV2(options, pluginOptions, execCompile, metaType) {
config.output.path(path.resolve(rootDir, `${buildTarget}/${lowcodeDir}`));
config.externals({ ...COMMON_EXTERNALS_MAP[engineScope], ...externals });
useStyleLoader(config);

const chain = options.context.userConfig.chainWebpack;
if(chain) chain(config, `lowcode-meta-${metaType}`);
});
return metaPath;
}
Expand Down Expand Up @@ -920,6 +925,8 @@ async function bundleEditorView(
const scssRule = config.module.rule('scss');
scssRule.use('rpx-loader').loader('rpx-loader').before('css-loader');
}
const chain = options.context.userConfig.chainWebpack;
if(chain) chain(config, 'lowcode-editor-view');
});
return viewPath;
}
Expand Down Expand Up @@ -1002,6 +1009,8 @@ async function bundleRenderView(options, pluginOptions, platform, execCompile) {
const scssRule = config.module.rule('scss');
scssRule.use('rpx-loader').loader('rpx-loader').before('css-loader');
}
const chain = options.context.userConfig.chainWebpack;
if(chain) chain(config, `render-view-${platform}`);
});
return viewPath;
}
Expand Down Expand Up @@ -1290,6 +1299,9 @@ async function bundleComponentMeta(webPackConfig, options, pluginOptions, execCo
config.output.path(path.resolve(rootDir, `${buildTarget}/${lowcodeDir}`));
config.externals({ ...COMMON_EXTERNALS_MAP[engineScope], ...externals });
useStyleLoader(config);

const chain = options.context.userConfig.chainWebpack;
if(chain) chain(config, taskName);
});
})(component, idx);
});
Expand Down