Last active
March 21, 2019 16:51
-
-
Save misterdev/a6cfa1042092cd0a54b52ce3030959d3 to your computer and use it in GitHub Desktop.
6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Generator = require('yeoman-generator'); | |
const { List, Input, InputValidate } = require('@webpack-cli/webpack-scaffold'); | |
// => Import our webpack config generator | |
const createWebpackConfig = require('./config/webpack'); | |
module.exports = class WebpackGenerator extends Generator { | |
/* ... */ | |
prompting() { | |
return this.prompt([ /* ... */ ]).then (answers => { | |
this.answers = answers; | |
/* ... */ | |
this.options.env.configuration.dev = { | |
// => This add the plugins imports at the beginning of our generated webpack.config.js | |
topScope = [ | |
"const HtmlWebpackPlugin = require('html-webpack-plugin')", | |
"const CopyWebpackPlugin = require('copy-webpack-plugin')", | |
"const VueLoaderPlugin = require('vue-loader/lib/plugin')" | |
], | |
// => This generates a configuration using the user preferences | |
webpackOptions: createWebpackConfig(this.answers) | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment