Skip to content

Commit 980e90c

Browse files
committed
vue-cli
1 parent 3bb8c95 commit 980e90c

File tree

3 files changed

+14
-19
lines changed

3 files changed

+14
-19
lines changed

generators/vue/generator.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export default class VueGenerator extends BaseApplicationGenerator {
129129
return this.asPostWritingTaskGroup({
130130
microfrontend({ application }) {
131131
if (!application.microfrontend) return;
132-
this.addWebpackConfig("require('./webpack.microfrontend')({ serve: options.env.WEBPACK_SERVE })", application.clientFramework);
132+
this.addWebpackConfig("require('./webpack.microfrontend')(options)", application.clientFramework);
133133
},
134134
});
135135
}

generators/vue/templates/vue.commands.js.ejs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,36 +21,21 @@ const commonWebpack = require('./webpack/webpack.common');
2121
// eslint-disable-next-line @typescript-eslint/no-var-requires
2222
const devWebpack = require('./webpack/webpack.dev');
2323

24-
const configureWebpack = {
25-
resolve: {
26-
alias: {
27-
vue$: 'vue/dist/vue.esm.js',
28-
'@': __dirname + '/<%= clientSrcDir %>app',
29-
},
30-
},
31-
entry: {
32-
global: './<%= clientSrcDir %>content/scss/global.scss',
33-
app: './<%= clientSrcDir %>app/main.ts',
34-
},
35-
};
36-
3724
module.exports = (api, options) => {
3825
api.service.commands['build:original'] = api.service.commands.build;
3926
api.service.commands['serve:original'] = api.service.commands.serve;
4027

4128
api.registerCommand('build', async (args, rawArgs) => {
4229
// Force extract for development mode, otherwise css assets are not emitted.
4330
options.css.extract = true;
44-
const webpackConfig = await commonWebpack(api.service);
31+
const webpackConfig = await commonWebpack(api.service, {});
4532
api.configureWebpack(webpackConfig);
46-
api.configureWebpack(configureWebpack);
4733
await api.service.run('build:original', args, rawArgs);
4834
});
4935
api.registerCommand('serve', async (args, rawArgs) => {
50-
const webpackConfig = await commonWebpack(api.service);
36+
const webpackConfig = await commonWebpack(api.service, { serve: true });
5137
api.configureWebpack(webpackConfig);
5238
api.configureWebpack(devWebpack);
53-
api.configureWebpack(configureWebpack);
5439
await api.service.run('serve:original', args, rawArgs);
5540
});
5641
};

generators/vue/templates/webpack/webpack.common.js.ejs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function resolve(dir = '') {
2929
return path.join(__dirname, '..', dir);
3030
}
3131

32-
module.exports = async configuration => {
32+
module.exports = async (configuration, options) => {
3333
<%_ if (enableTranslation) { _%>
3434
const languagesHash = await hashElement(resolve('<%= clientSrcDir %>i18n'), {
3535
algo: 'md5',
@@ -54,6 +54,16 @@ module.exports = async configuration => {
5454

5555
return merge(
5656
{
57+
resolve: {
58+
alias: {
59+
vue$: 'vue/dist/vue.esm.js',
60+
'@': resolve('/<%= clientSrcDir %>app'),
61+
},
62+
},
63+
entry: {
64+
global: './<%= clientSrcDir %>content/scss/global.scss',
65+
app: './<%= clientSrcDir %>app/main.ts',
66+
},
5767
<%_ if (applicationTypeGateway && microfrontend) { _%>
5868
experiments: {
5969
topLevelAwait: true,

0 commit comments

Comments
 (0)