exports = module.exports = (paths, argv) => {
const webpack = require('webpack');
let plugins = [];
//#region Define plugin
// Shared environment configurations.
let sharedEnvProperties = {
PATHS: JSON.stringify(paths)
};
// Environment properties.
let env = {};
// In production mode.
if (argv.production)
env = Object.assign({}, require('../shared/env/production')(paths, argv), sharedEnvProperties);
else
env = Object.assign({}, require('../shared/env/development')(paths, argv), sharedEnvProperties);
plugins.push(new webpack.DefinePlugin(env));
//#endregion
//#region Ignore plugin
plugins.push(new webpack.IgnorePlugin(/vertx/));
plugins.push(new webpack.IgnorePlugin(/bufferutil/));
plugins.push(new webpack.IgnorePlugin(/spawn-sync/));
plugins.push(new webpack.IgnorePlugin(/utf-8-validate/));
//#endregion
// Import node libs.
const path = require('path');
return {
entry: {
'main': path.resolve(paths.src, 'main.js')
},
target: 'electron-main',
mode: argv.production ? 'production' : 'development',
context: paths.root,
devtool: !argv.production ? 'source-map' : false,
optimization: {
runtimeChunk: false,
splitChunks: {
chunks: 'all',
cacheGroups: {
default: {
enforce: true,
priority: 1
},
vendors: {
test: /[\\/]node_modules[\\/]/,
priority: 2,
name: 'main-vendors',
enforce: true,
chunks: 'async'
}
}
}
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: "babel-loader!ts-loader"
},
{
test: /\.js$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
options: {
presets: [['env', {"modules": false}]]
}
}
}
]
},
plugins: plugins,
output: {
filename: '[name].js'
},
resolve: {
// Add `.ts` and `.tsx` as a resolvable extension.
extensions: [".ts", ".tsx", ".js"]
},
watch: !argv.production,
watchOptions: {
poll: false
},
node: {
__filename: true,
__dirname: true
// __dirname: false,
// __filename: false
},
externals: {
'node-notifier': 'commonjs node-notifier'
}
};
};
以上代码以这种形式输出-
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
def run(s)
begin
if s.size == 6
exit
end
$chars.each_char do |y|
s = s + y
puts s
puts run(s)
end
end
end
run('A')
但是我希望它继续到下一个字符,例如-
AA
AAA
AAAA
AAAAA
AAAAAA
我能够使它与4个循环一起工作,但是我不能使用递归。 任何帮助和建议,我们感激不尽。谢谢!