We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webpack 开箱即用只支持JS和JSON两种格式,通过loader去支持其他文件类型并且把他们转化为有效的模块,并且可以添加到依赖图中。
loader本身是一个函数,接受源文件为参数,返回转换的结果
常见的loader有
Loaders 的用法
// 配置示例 const path = require('path'); module.exports = { output: { filename: 'bundle.js' }, module: { rules: [{ test: /\.txt$/, // test 指定匹配规则 use: 'raw-loader' // use 指定使用的 loader 名称 }] } };
插件用于bundle文件的优化,资源管理和环境变量注入,作用于整个构建过程
常见的plugins
Plugins 的用法
const path = require('path'); module.exports = { output: { filename: 'bundle.js' }, plugins: [ // 放在plugins 数组中 new HtmlWebpackPlugin({ template: './src/index.html' }) ] };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Loaders
webpack 开箱即用只支持JS和JSON两种格式,通过loader去支持其他文件类型并且把他们转化为有效的模块,并且可以添加到依赖图中。
loader本身是一个函数,接受源文件为参数,返回转换的结果
常见的loader有
Loaders 的用法
Plugins
插件用于bundle文件的优化,资源管理和环境变量注入,作用于整个构建过程
常见的plugins
Plugins 的用法
The text was updated successfully, but these errors were encountered: