Skip to content
This repository has been archived by the owner on Feb 22, 2021. It is now read-only.

Commit

Permalink
fix JS error from zepto
Browse files Browse the repository at this point in the history
Workaround while waiting for madrobby/zepto#1319
  • Loading branch information
kontrollanten committed Jan 28, 2018
1 parent 52d58d8 commit 53e624e
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"sinon": "^4.2.1",
"sinon-chai": "^2.14.0",
"snyk": "^1.69.3",
"string-replace-webpack-plugin": "^0.1.3",
"webpack": "^3.10.0"
},
"dependencies": {
Expand Down
22 changes: 22 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const path = require('path');
const webpack = require('webpack');
const StringReplacePlugin = require('string-replace-webpack-plugin');

module.exports = {
entry: './src/index.js',
Expand All @@ -16,6 +17,27 @@ module.exports = {
test: /\.js$/,
exclude: /\test.js$/,
loader: 'babel-loader'
},
{
/** Workaround while waiting for https://github.com/madrobby/zepto/pull/1319 */
test: /\.js$/,
loader: StringReplacePlugin.replace({
replacements: [
{
pattern: /e.data = data/g,
replacement: function() {
return `
var dataPropDescriptor = Object.getOwnPropertyDescriptor(e, 'data')
if (!dataPropDescriptor || dataPropDescriptor.writable) {
try {
e.data = data
} catch (error) { }
}
`;
},
}
]
})
}
]
},
Expand Down
54 changes: 54 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,10 @@ async@^2.1.2, async@^2.1.4:
dependencies:
lodash "^4.14.0"

async@~0.2.10:
version "0.2.10"
resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1"

async@~0.9.0:
version "0.9.2"
resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d"
Expand Down Expand Up @@ -1568,6 +1572,14 @@ crypto-random-string@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-1.0.0.tgz#a230f64f568310e1498009940790ec99545bca7e"

css-loader@^0.9.1:
version "0.9.1"
resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-0.9.1.tgz#2e1aa00ce7e30ef2c6a7a4b300a080a7c979e0dc"
dependencies:
csso "1.3.x"
loader-utils "~0.2.2"
source-map "~0.1.38"

css-select@~1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/css-select/-/css-select-1.2.0.tgz#2b3a110539c5355f1cd8d314623e870b121ec858"
Expand All @@ -1581,6 +1593,10 @@ css-what@2.1:
version "2.1.0"
resolved "https://registry.yarnpkg.com/css-what/-/css-what-2.1.0.tgz#9467d032c38cfaefb9f2d79501253062f87fa1bd"

csso@1.3.x:
version "1.3.12"
resolved "https://registry.yarnpkg.com/csso/-/csso-1.3.12.tgz#fc628694a2d38938aaac4996753218fd311cdb9e"

cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0":
version "0.3.2"
resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.2.tgz#b8036170c79f07a90ff2f16e22284027a243848b"
Expand Down Expand Up @@ -2344,6 +2360,12 @@ file-entry-cache@^2.0.0:
flat-cache "^1.2.1"
object-assign "^4.0.1"

file-loader@^0.8.1:
version "0.8.5"
resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-0.8.5.tgz#9275d031fe780f27d47f5f4af02bd43713cc151b"
dependencies:
loader-utils "~0.2.5"

filename-regex@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26"
Expand Down Expand Up @@ -3767,6 +3789,15 @@ loader-runner@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.3.0.tgz#f482aea82d543e07921700d5a46ef26fdac6b8a2"

loader-utils@^0.2.5, loader-utils@~0.2.2, loader-utils@~0.2.3, loader-utils@~0.2.5:
version "0.2.17"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.17.tgz#f86e6374d43205a6e6c60e9196f17c0299bfb348"
dependencies:
big.js "^3.1.3"
emojis-list "^2.0.0"
json5 "^0.5.0"
object-assign "^4.0.1"

loader-utils@^1.0.2, loader-utils@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.1.0.tgz#c98aef488bcceda2ffb5e2de646d6a754429f5cd"
Expand Down Expand Up @@ -5498,6 +5529,12 @@ source-map@^0.6.0, source-map@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"

source-map@~0.1.38:
version "0.1.43"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.43.tgz#c24bc146ca517c1471f5dacbe2571b2b7f9e3346"
dependencies:
amdefine ">=0.0.4"

spdx-correct@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40"
Expand Down Expand Up @@ -5572,6 +5609,17 @@ string-length@^2.0.0:
astral-regex "^1.0.0"
strip-ansi "^4.0.0"

string-replace-webpack-plugin@^0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/string-replace-webpack-plugin/-/string-replace-webpack-plugin-0.1.3.tgz#73c657e759d66cfe80ae1e0cf091aa256d0e715c"
dependencies:
async "~0.2.10"
loader-utils "~0.2.3"
optionalDependencies:
css-loader "^0.9.1"
file-loader "^0.8.1"
style-loader "^0.8.3"

string-width@^1.0.1, string-width@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3"
Expand Down Expand Up @@ -5631,6 +5679,12 @@ strip-json-comments@~2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"

style-loader@^0.8.3:
version "0.8.3"
resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-0.8.3.tgz#f4f92eb7db63768748f15065cd6700f5a1c85357"
dependencies:
loader-utils "^0.2.5"

subcommand@^2.0.3:
version "2.1.0"
resolved "https://registry.yarnpkg.com/subcommand/-/subcommand-2.1.0.tgz#5e4ceca5a3779e3365b1511e05f866877302f760"
Expand Down

0 comments on commit 53e624e

Please sign in to comment.