node.js - webpack entry中的name是带路径的,结合ExtractTextPlugin使用时,如何得到不带路径的name
PHPz
PHPz 2017-04-17 15:41:28
0
1
497

entry如下:

entry: {
    // 名字可以含路径,以用来将打包后的文件放入不同的路径
    'js/index': [
        path.resolve(src, 'index.js') // Your appʼs entry point
    ],
    'js/detail': [
        path.resolve(src, 'detail/detail.jsx') // Your appʼs entry point
    ],
    'lib/eg': [
        path.resolve(src, 'eg/lib.js') // Your appʼs entry point
    ],
  },

而在webpack的plugins中,使用了ExtractTextPlugin,配置是:

new ExtractTextPlugin("css/[name].css", {
        // allChunks: true
    })

最终打包出来的css文件,会被放到css/js/detail.css与,css/js/index.css,多了一级'js/',我想知道如何设置能让css文件统一放到css/*.css这样的路径下

PHPz
PHPz

学习是最好的投资!

reply all(1)
巴扎黑

Originally, the trick of adding paths in names is to achieve modularization so that js and css can belong to the same module. I suggest you change the structure of your packaged files

In other words, forcefully cancel the path:

new ExtractTextPlugin("css/[contenthash:8].[name].css")

If you do this, the file name will be a bit ugly, but at least the file level will be as you wish

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!