Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm trying to move from Gulp to Webpack .(我正在尝试从Gulp迁移到Webpack 。)

In Gulp I have task which copies all files and folders from /static/ folder to /build/ folder.(在Gulp我的任务是将所有文件和文件夹从/ static /文件夹复制到/ build /文件夹。) How to do the same with Webpack ?(如何用Webpack做同样的Webpack ?) Do I need some plugin?(我需要一些插件吗?)   ask by Vitalii Korsakov translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
468 views
Welcome To Ask or Share your Answers For Others

1 Answer

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-pluginnpmGithub )直接复制静态文件。) 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' }
        ])
    ]
};

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...