Skip to content

Commit

Permalink
fix(npm-init): template初始化
Browse files Browse the repository at this point in the history
template初始化
  • Loading branch information
Rabi-Wang committed Jan 6, 2021
1 parent fedfaf0 commit 05d48cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions build/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const SpeedMeasurePlugin = require('speed-measure-webpack-plugin')
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
const baseConfig = require('./webpack.base.config')
const devConfig = require('./webpack.dev.config')
const proConfig = require('./webpack.pro.config')
const proConfig = require('./webpack.pro.config')()

const smp = new SpeedMeasurePlugin()

Expand All @@ -18,13 +18,13 @@ module.exports = (env, argv) => {
proConfig.plugins[0] = new webpack.DefinePlugin({
HTTP_ENV: JSON.stringify('test'),
})
return proConfig
return () => proConfig
})()
default: return proConfig
default: return () => proConfig
}
})() : (() => {
proConfig.plugins.push(new BundleAnalyzerPlugin())
return proConfig
return () => proConfig
})()

return argv.isAnalyze ? smp.wrap(merge(baseConfig(env, argv), config(env, argv))) : merge(baseConfig(env, argv), config(env, argv))
Expand Down
1 change: 1 addition & 0 deletions src/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ async function create(projectName, options) {
path.join(targetDir, 'package.json'),
JSON.stringify(packageJson, null, 2)
)
execSync('npm init --y', { cwd: targetDir, stdio: 'inherit' })
}
if (fs.existsSync(path.join(__dirname, '../build'))) {
fs.copySync(path.join(__dirname, '../build'), path.join(targetDir, './build'))
Expand Down

0 comments on commit 05d48cb

Please # to comment.