Requiring assets using the file-loader module is the way webpack is intended to be used ( source ).(使用文件加载器模块来请求资产是打算使用webpack的方式( 来源 )。)
However, if you need greater flexibility or want a cleaner interface, you can also copy static files directly using my copy-webpack-plugin
( npm , Github ).(但是,如果您需要更大的灵活性或想要一个更copy-webpack-plugin
界面,也可以使用我的copy-webpack-plugin
( npm , Github )直接复制静态文件。) For your static
to build
example:(为您的static
build
示例:)
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
context: path.join(__dirname, 'your-app'),
plugins: [
new CopyWebpackPlugin([
{ from: 'static' }
])
]
};
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…