@@ -26,8 +26,12 @@ const webpackConfig = merge(baseWebpackConfig, {
2626 devtool : config . build . productionSourceMap ? config . build . devtool : false ,
2727 output : {
2828 path : config . build . assetsRoot ,
29- filename : utils . assetsPath ( 'js/[name].[chunkhash].js' ) ,
30- chunkFilename : utils . assetsPath ( 'js/[id].[chunkhash].js' )
29+ filename : utils . assetsPath ( 'vuecsv.min.js' ) ,
30+ library : 'VueCSV' ,
31+ libraryTarget : 'umd'
32+ } ,
33+ externals : {
34+ 'vue' : 'Vue'
3135 } ,
3236 plugins : [
3337 // http://vuejs.github.io/vue-loader/en/workflow/production.html
@@ -45,11 +49,7 @@ const webpackConfig = merge(baseWebpackConfig, {
4549 } ) ,
4650 // extract css into its own file
4751 new ExtractTextPlugin ( {
48- filename : utils . assetsPath ( 'css/[name].[contenthash].css' ) ,
49- // Setting the following option to `false` will not extract CSS from codesplit chunks.
50- // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
51- // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
52- // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
52+ filename : utils . assetsPath ( 'vuecsv.min.css' ) ,
5353 allChunks : true ,
5454 } ) ,
5555 // Compress extracted CSS. We are using this plugin so that possible
@@ -70,77 +70,15 @@ const webpackConfig = merge(baseWebpackConfig, {
7070 inject : true ,
7171 minify : {
7272 removeComments : true ,
73- collapseWhitespace : true ,
73+ collapseWhitespace : false ,
7474 removeAttributeQuotes : true
75- // more options:
76- // https://github.com/kangax/html-minifier#options-quick-reference
7775 } ,
7876 // necessary to consistently work with multiple chunks via CommonsChunkPlugin
7977 chunksSortMode : 'dependency'
80- } ) ,
81- // keep module.id stable when vendor modules does not change
82- new webpack . HashedModuleIdsPlugin ( ) ,
83- // enable scope hoisting
84- new webpack . optimize . ModuleConcatenationPlugin ( ) ,
85- // split vendor js into its own file
86- new webpack . optimize . CommonsChunkPlugin ( {
87- name : 'vendor' ,
88- minChunks ( module ) {
89- // any required modules inside node_modules are extracted to vendor
90- return (
91- module . resource &&
92- / \. j s $ / . test ( module . resource ) &&
93- module . resource . indexOf (
94- path . join ( __dirname , '../node_modules' )
95- ) === 0
96- )
97- }
98- } ) ,
99- // extract webpack runtime and module manifest to its own file in order to
100- // prevent vendor hash from being updated whenever app bundle is updated
101- new webpack . optimize . CommonsChunkPlugin ( {
102- name : 'manifest' ,
103- minChunks : Infinity
104- } ) ,
105- // This instance extracts shared chunks from code splitted chunks and bundles them
106- // in a separate chunk, similar to the vendor chunk
107- // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
108- new webpack . optimize . CommonsChunkPlugin ( {
109- name : 'app' ,
110- async : 'vendor-async' ,
111- children : true ,
112- minChunks : 3
113- } ) ,
114-
115- // copy custom static assets
116- new CopyWebpackPlugin ( [
117- {
118- from : path . resolve ( __dirname , '../static' ) ,
119- to : config . build . assetsSubDirectory ,
120- ignore : [ '.*' ]
121- }
122- ] )
78+ } )
12379 ]
12480} )
12581
126- if ( config . build . productionGzip ) {
127- const CompressionWebpackPlugin = require ( 'compression-webpack-plugin' )
128-
129- webpackConfig . plugins . push (
130- new CompressionWebpackPlugin ( {
131- asset : '[path].gz[query]' ,
132- algorithm : 'gzip' ,
133- test : new RegExp (
134- '\\.(' +
135- config . build . productionGzipExtensions . join ( '|' ) +
136- ')$'
137- ) ,
138- threshold : 10240 ,
139- minRatio : 0.8
140- } )
141- )
142- }
143-
14482if ( config . build . bundleAnalyzerReport ) {
14583 const BundleAnalyzerPlugin = require ( 'webpack-bundle-analyzer' ) . BundleAnalyzerPlugin
14684 webpackConfig . plugins . push ( new BundleAnalyzerPlugin ( ) )
0 commit comments