File tree Expand file tree Collapse file tree 5 files changed +28
-18
lines changed Expand file tree Collapse file tree 5 files changed +28
-18
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ exports.cssLoaders = function (options) {
34
34
35
35
// Extract CSS when that option is specified
36
36
// (which is the case during production build)
37
- if ( options . extract ) {
37
+ if ( options . extract && ! ! ! process . env . DIST_ENV ) {
38
38
return ExtractTextPlugin . extract ( {
39
39
use : loaders ,
40
40
fallback : 'vue-style-loader'
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ var HtmlWebpackPlugin = require('html-webpack-plugin')
9
9
var ExtractTextPlugin = require ( 'extract-text-webpack-plugin' )
10
10
var OptimizeCSSPlugin = require ( 'optimize-css-assets-webpack-plugin' )
11
11
12
+ var isDist = ! ! process . env . DIST_ENV
13
+
12
14
var env = process . env . NODE_ENV === 'testing'
13
15
? require ( '../config/test.env' )
14
16
: config . build . env
@@ -35,8 +37,22 @@ var webpackConfig = merge(baseWebpackConfig, {
35
37
compress : {
36
38
warnings : false
37
39
} ,
38
- sourceMap : true
39
- } ) ,
40
+ sourceMap : config . build . productionSourceMap
41
+ } )
42
+ ]
43
+ } )
44
+
45
+ if ( isDist ) {
46
+ webpackConfig . entry = {
47
+ 'vue-json-pretty' : './src/index.js'
48
+ }
49
+ webpackConfig . output = {
50
+ filename : './dist/[name].js' ,
51
+ library : 'VueJsonPretty' ,
52
+ libraryTarget : 'umd'
53
+ }
54
+ } else {
55
+ webpackConfig . plugins . push (
40
56
// extract css into its own file
41
57
new ExtractTextPlugin ( {
42
58
filename : utils . assetsPath ( 'css/[name].[contenthash].css' )
@@ -97,8 +113,8 @@ var webpackConfig = merge(baseWebpackConfig, {
97
113
ignore : [ '.*' ]
98
114
}
99
115
] )
100
- ]
101
- } )
116
+ )
117
+ }
102
118
103
119
if ( config . build . productionGzip ) {
104
120
var CompressionWebpackPlugin = require ( 'compression-webpack-plugin' )
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ module.exports = {
8
8
assetsRoot : path . resolve ( __dirname , '../example-dist' ) ,
9
9
assetsSubDirectory : 'static' ,
10
10
assetsPublicPath : '/' ,
11
- productionSourceMap : true ,
11
+ productionSourceMap : false ,
12
12
// Gzip off by default as many popular static hosts such as
13
13
// Surge or Netlify already gzip all static assets for you.
14
14
// Before setting to `true`, make sure to:
Original file line number Diff line number Diff line change 6
6
"private" : true ,
7
7
"scripts" : {
8
8
"dev" : " node build/dev-server.js" ,
9
- "build-example" : " node build/build.js" ,
9
+ "build" : " node build/build.js" ,
10
+ "dist" : " cross-env DIST_ENV=true npm run build" ,
10
11
"e2e" : " node test/e2e/runner.js" ,
11
12
"test" : " npm run e2e" ,
12
13
"lint" : " eslint --ext .js,.vue src test/e2e/specs"
27
28
"chromedriver" : " ^2.27.2" ,
28
29
"connect-history-api-fallback" : " ^1.3.0" ,
29
30
"copy-webpack-plugin" : " ^4.0.1" ,
31
+ "cross-env" : " ^5.0.5" ,
30
32
"cross-spawn" : " ^5.0.1" ,
31
33
"css-loader" : " ^0.28.0" ,
32
34
"cssnano" : " ^3.10.0" ,
Original file line number Diff line number Diff line change 1
- // The Vue build version to load with the `import` command
2
- // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
3
- import Vue from 'vue'
4
- import App from './App'
1
+ import VueJsonPretty from './components/tree.vue'
5
2
6
- Vue . config . productionTip = false
7
-
8
- /* eslint-disable no-new */
9
- new Vue ( {
10
- el : '#app' ,
11
- template : '<App/>' ,
12
- components : { App }
3
+ export default Object . assign ( { } , VueJsonPretty , {
4
+ version : '1.0.0'
13
5
} )
You can’t perform that action at this time.
0 commit comments