LoginSignup
8
2

More than 5 years have passed since last update.

古いAndroid WebviewでUglifyJSを通ったVue.js 1.0.28がSyntax Errorと判断される

Last updated at Posted at 2017-03-28

以下のdependenciesでお送りします

package.json
{
  "vue": "1.0.28"
}

該当ケース

該当端末は OPTIMUS L-01D とか古いArrowsとか。
元2.3端末が4.xに更新されたものの、Webviewがまともに更新されていない系端末に見られるバグで、
通常のAndroid Browser上では問題ないので意識低めのエッジケース。
Android 2.x系もなるんじゃないだろうかと思いつつ、今の時代に考えても意味がないので今回は考えない。

解決法

output.keep_quoted_propstrueにする。

webpack.js
plugins: [
  new webpack.optimize.UglifyJsPlugin({
    output: {
      keep_quoted_props: true
    }
  })
]

原因

https://github.com/vuejs/vue/blob/1.0/src/directives/internal/index.js#L9
ここのクォーテーションが取れてUncaught SyntaxError: Unexpected strict mode reserved wordとなる。
予約語のclassだと判断されてしまうようだ。

8
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
2