-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #133 from JulianMar/master
Fix SSR
- Loading branch information
Showing
12 changed files
with
158 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
build/*.js | ||
dist/*.js | ||
config/*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module.exports = (api) => { | ||
const isTest = api.env('test') | ||
|
||
const config = { | ||
presets: [ | ||
['@babel/preset-env', { | ||
targets: { | ||
'browsers': ['last 2 versions', 'IE 11'] | ||
}, | ||
useBuiltIns: 'usage' | ||
}] | ||
] | ||
} | ||
|
||
if (isTest) { | ||
api.cache.never() | ||
} | ||
|
||
return config | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,25 @@ | ||
/* eslint-disable */ | ||
|
||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin | ||
const webpack = require('webpack') | ||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin') | ||
const base = require('./webpack.base.conf') | ||
|
||
var config = Object.assign({}, base) | ||
|
||
config.output.filename = 'vue-carousel-3d.min.js' | ||
|
||
config.plugins = (config.plugins || []).concat([ | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compress: { warnings: false }, | ||
new UglifyJsPlugin({ | ||
sourceMap: false | ||
}), | ||
new webpack.DefinePlugin({ | ||
'process.env': { | ||
NODE_ENV: '"production"' | ||
} | ||
}), | ||
}) | ||
]) | ||
|
||
config.mode = 'production' | ||
|
||
module.exports = config |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
"use strict" | ||
'use strict' | ||
|
||
const Vue = require('vue'); | ||
const Html2jade = require('html2jade'); | ||
const Vue = require('vue') | ||
const Html2jade = require('html2jade') | ||
|
||
/** convert html to pug as a Promise */ | ||
function html2pug(html) { | ||
return new Promise((resolve, reject) => { | ||
Html2jade.convertHtml(html, {bodyless: true}, (err, jade) => { | ||
if (err) { | ||
reject(err) | ||
} else { | ||
resolve(jade) | ||
} | ||
function html2pug (html) { | ||
return new Promise((resolve, reject) => { | ||
Html2jade.convertHtml(html, { bodyless: true }, (err, jade) => { | ||
if (err) { | ||
reject(err) | ||
} else { | ||
resolve(jade) | ||
} | ||
}) | ||
}) | ||
}) | ||
} | ||
|
||
/** call vm.nextTick() as a Promise */ | ||
function nextTick(vm) { | ||
return new Promise((resolve, reject) => { | ||
Vue.nextTick(() => resolve()) | ||
}) | ||
function nextTick (vm) { | ||
return new Promise((resolve, reject) => { | ||
Vue.nextTick(() => resolve()) | ||
}) | ||
} | ||
|
||
/** call vm.nextTick() and check the snapshot as a Promise */ | ||
function expectToMatchSnapshot(vm, element) { | ||
return new Promise((resolve, reject) => { | ||
nextTick(vm).then(() => html2pug((element || vm.$el).innerHTML)).then((jade) => { | ||
expect(jade).toMatchSnapshot() | ||
resolve() | ||
}).catch((err)=>(reject(err))) | ||
}) | ||
function expectToMatchSnapshot (vm, element) { | ||
return new Promise((resolve, reject) => { | ||
nextTick(vm).then(() => html2pug((element || vm.$el).innerHTML)).then((jade) => { | ||
expect(jade).toMatchSnapshot() | ||
resolve() | ||
}).catch((err) => (reject(err))) | ||
}) | ||
} | ||
|
||
exports.expectToMatchSnapshot = expectToMatchSnapshot; | ||
exports.expectToMatchSnapshot = expectToMatchSnapshot |
Oops, something went wrong.