Skip to content

CommonsChunkPlugin生成的vendor无用 #14

@NotGeekAtAll

Description

@NotGeekAtAll

我用CommonsChunkPlugin合成vue,vue-resource,成功生成了vendor并且导入到了html里,但是用vue还是报vue不存在。

entry: { index: './src/js/page/index.js', vendor: ['./src/js/lib/vue.js','./src/js/lib/vue-resource.js'] },

plugins: [ // new webpack.ProvidePlugin({ //加载jq // $: 'jquery' // }), new ExtractTextPlugin('css/[name].css'), //单独使用link标签加载css并设置路径,相对于output配置中的publickPath new webpack.optimize.CommonsChunkPlugin('vendor', 'js/vendor.bundle.js'), //HtmlWebpackPlugin,模板生成相关的配置,每个对于一个页面的配置,有几个写几个 new HtmlWebpackPlugin({ //根据模板插入css/js等生成最终HTML filename: './views/index.html', //生成的html存放路径,相对于path template: './src/views/index.html', //html模板路径 inject: 'body', //js插入的位置,true/'head'/'body'/false hash: true, //为静态资源生成hash值 chunks: ['index'],//需要引入的chunk,不配置就会引入所有页面的资源 minify: { //压缩HTML文件 removeComments: true, //移除HTML中的注释 collapseWhitespace: false //删除空白符与换行符 } }) ],

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions