You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"scripts": {"test": "echo \"Error: no test specified\" && exit 1","buid":"webpack --config webpack.config.js"}
webpack.config.js文件中的内容,此时配置很弱,只能打包JS文件
//webpack是node写出来的 所以要使用node的写法letpath=require('path');//内置模块,不需要安装,直接引用即可module.exports={mode:'development',//模式 默认有两种 production developmententry:'./src/index.js',//入口 output:{filename:'bundle.js',//打包后的文件名path:path.resolve(__dirname,'dist'),//路径必须是一个绝对路径,resove可以将相对路径解析为为绝对路径//__dirname意思是以当前目录新建文件夹dist}}
为什么文件名一定要叫webpack.config.js?
node_module下默认运行webpack
webpack 默认下会调用webpack-cli
cli里会有解析参数的对象 config-yargs.js文件
config: {type: "string",describe: "Path to the config file",group: CONFIG_GROUP,defaultDescription: "webpack.config.js or webpackfile.js",requiresArg: true}
webpack4.0简介
1.可以做的事情
2.需要提前掌握的内容
3.webpack安装
注:-y表示yes的意思,在init的时候省去了敲回车的步骤,生成的默认的package.json
注:-D表示当前是开发依赖,上线的时候不需要
4.webpack可以进行0配置
5.手动配置webpack
为什么文件名一定要叫webpack.config.js?
6.大致了解打包后的文件
End
by wind-jyf
cnpm i babel-core babel-loader babel-plugin-transform-runtime -D
cnpm i babel-preset-env babel-preset-stage-0 babel-preset-react -D
The text was updated successfully, but these errors were encountered: