zoukankan      html  css  js  c++  java
  • 对webpack的配置文件吐个槽

    webpack官方文档

    entry

    The entry point for the bundle.

    If you pass a string: The string is resolved to a module which is loaded upon startup.

    If you pass an array: All modules are loaded upon startup. The last one is exported.

    entry: ["./entry1", "./entry2"]
    

    If you pass an object: Multiple entry bundles are created. The key is the chunk name. The value can be a string or an array.

    {
    
    entry: {
        page1: "./page1",
        page2: ["./entry1", "./entry2"]
    },
    output: {
        // Make sure to use [name] or [id] in output.filename
        //  when using multiple entry points
        filename: "[name].bundle.js",
        chunkFilename: "[id].bundle.js"
    }
    

    }

    
    文档中对entry的说明看起来是详细的,但是文档中可没说,这货还可以这么省略地写,look!
    
    假如入口文件是`src/index.js`,那么在`webpack.config.js`中就可以这么写:
    
    ```js
    // String
    {
    	entry: './src/index.js',
    	output: {
    		path: './dist',
    		filename: '[name].bundle.js'
    	}
    }
    
    // 或者不指定entry的文件后缀也是可以的
    {
    	entry: './src/index',
    	output: {
    		path: './dist',
    		filename: '[name].bundle.js'
    	}
    }
    

    除了可以省略entry的后缀,这货甚至还支持类似apachenginxDirectoryIndex
    也就是说可以指定默认文件,这货的默认文件就是index.js。对应的配置就可以写成下面这样了:

    {
    	entry: './src',
    	output: {
    		path: './dist',
    		filename: '[name].bundle.js'
    	}
    }
    

    Ps: 感慨一下,这东西灵活归灵活,但还是建议按常规写法来,清晰明了多好呀,至少看起来一目了然。

  • 相关阅读:
    (转) hive调优(2)
    (转)hive调优(1) coding调优
    hive on tez 错误记录
    tez 0.9.0 配置
    hive on tez
    让博客园自动生成目录
    hive --metastore三种模式
    hive 使用beelin连接报错
    mysql my.cnf文件
    1、Kfaka 部署
  • 原文地址:https://www.cnblogs.com/erniu/p/5784584.html
Copyright © 2011-2022 走看看