Skip to content

Commit 0a0bd2a

Browse files
committed
Transpile to ES5 instead of XWalk
1 parent 1d4bd99 commit 0a0bd2a

File tree

6 files changed

+69
-16
lines changed

6 files changed

+69
-16
lines changed

.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["env"]
3+
}

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build/*.js
2+
config/*.js
3+
webpack.config.js

.eslintrc.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// http://eslint.org/docs/user-guide/configuring
2+
3+
module.exports = {
4+
root: true,
5+
parser: 'babel-eslint',
6+
parserOptions: {
7+
sourceType: 'module'
8+
},
9+
env: {
10+
browser: true,
11+
},
12+
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
13+
extends: 'standard',
14+
// required to lint *.vue files
15+
plugins: [
16+
'html'
17+
],
18+
// add your custom rules here
19+
'rules': {
20+
// allow paren-less arrow functions
21+
'arrow-parens': 0,
22+
// allow async-await
23+
'generator-star-spacing': 0,
24+
// allow debugger during development
25+
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
26+
// allow no space between function keyword and (
27+
'space-before-function-paren': 0
28+
}
29+
}

config.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,6 @@
5555
<plugin name="cordova-plugin-statusbar" spec="https://github.com/apache/cordova-plugin-statusbar.git"/>
5656
<plugin name="cordova-plugin-ios-longpress-fix" spec="~1.1.0"/>
5757
<plugin name="cordova-plugin-media" spec="~3.0.1"/>
58-
<plugin name="cordova-plugin-crosswalk-webview" spec="~2.3.0">
59-
<variable name="XWALK_VERSION" value="23+"/>
60-
<variable name="XWALK_LITEVERSION" value="xwalk_core_library_canary:17+"/>
61-
<variable name="XWALK_COMMANDLINE" value="--disable-pull-to-refresh-effect"/>
62-
<variable name="XWALK_MODE" value="embedded"/>
63-
<variable name="XWALK_MULTIPLEAPK" value="false"/>
64-
</plugin>
6558
<plugin name="cordova-plugin-localization-strings" spec="https://github.com/kelvinhokk/cordova-plugin-localization-strings.git"/>
6659
<plugin name="cordova-plugin-google-analytics" spec="~1.8.3"/>
6760
<plugin name="cordova-plugin-crop" spec="https://github.com/dodoinblue/cordova-plugin-crop"/>

package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,26 @@
1010
],
1111
"license": "ISC",
1212
"devDependencies": {
13+
"babel-core": "^6.26.0",
14+
"babel-eslint": "^7.2.3",
15+
"babel-loader": "^7.1.2",
16+
"babel-plugin-transform-runtime": "^6.23.0",
17+
"babel-preset-env": "^1.6.0",
1318
"cheerio": "^0.22.0",
1419
"chokidar": "^1.6.1",
1520
"clean-webpack-plugin": "^0.1.15",
1621
"css-loader": "^0.27.3",
1722
"device.js": "git+https://github.com/matthewhudson/device.js.git",
1823
"epipebomb": "^1.0.0",
24+
"eslint": "^4.5.0",
25+
"eslint-config-standard": "^10.2.1",
26+
"eslint-friendly-formatter": "^3.0.0",
27+
"eslint-loader": "^1.9.0",
28+
"eslint-plugin-html": "^3.2.0",
29+
"eslint-plugin-import": "^2.7.0",
30+
"eslint-plugin-node": "^5.1.1",
31+
"eslint-plugin-promise": "^3.5.0",
32+
"eslint-plugin-standard": "^3.0.1",
1933
"extract-text-webpack-plugin": "^2.1.0",
2034
"file-loader": "^0.10.1",
2135
"html-loader": "^0.4.5",

webpack.config.js

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
const path = require('path'),
22
fs = require('fs'),
3-
3+
44
webpack = require('webpack'),
55
HtmlWebpackPlugin = require('html-webpack-plugin'),
66
CordovaHtmlOutputPlugin = require('./webpack/plugins/CordovaHtmlOutputPlugin.js'),
77
UglifyJsPlugin = require('uglifyjs-webpack-plugin'),
88
CleanPlugin = require('clean-webpack-plugin'),
99
ExtractTextPlugin = require("extract-text-webpack-plugin"),
10-
10+
1111
entryFile = path.join(__dirname, 'src/main.js'),
1212
devServerPort = 8081
1313

@@ -16,7 +16,7 @@ let config = function (env) {
1616
entry: entryFile,
1717

1818
node: { fs: 'empty' },
19-
19+
2020
resolve: {
2121
extensions: ['.js', '.json', '.vue'],
2222
modules: [path.join(__dirname, 'src'), 'node_modules'],
@@ -28,17 +28,28 @@ let config = function (env) {
2828
'components': path.resolve(__dirname, 'src/assets/vue/components/')
2929
}
3030
},
31-
31+
3232
output: {
3333
pathinfo: true,
3434
devtoolLineToLine: true,
3535
filename: '[hash].[name].js',
3636
sourceMapFilename: "[hash].[name].js.map",
3737
path: path.join(__dirname, 'www')
3838
},
39-
39+
4040
module: {
4141
rules: [
42+
{
43+
test: /\.js$/,
44+
exclude: /(node_modules|bower_components)/,
45+
use: {
46+
loader: 'babel-loader',
47+
options: {
48+
presets: ['env'],
49+
plugins: ['transform-runtime']
50+
}
51+
}
52+
},
4253
{test: /\.(png|jpe?g|gif)$/, loader: 'file-loader', options: {name: '[name].[ext]?[hash]'}},
4354
{test: /\.(woff2?|eot|ttf|otf|mp3|wav)(\?.*)?$/, loader: 'file-loader', options: {name: '[name].[ext]?[hash]'}},
4455
{test: /\.svg$/, loader: 'url-loader'},
@@ -47,7 +58,7 @@ let config = function (env) {
4758
{test: /\.vue$/, loader: 'vue-loader'}
4859
]
4960
},
50-
61+
5162
plugins: [
5263
new webpack.DefinePlugin({
5364
'process.env': {
@@ -70,7 +81,7 @@ let config = function (env) {
7081
})
7182
]
7283
}
73-
84+
7485
if (typeof env === 'undefined' || typeof env.devserver === 'undefined') {
7586
returner.plugins.push(new CordovaHtmlOutputPlugin())
7687
returner.plugins.push(new ExtractTextPlugin("styles.css"))
@@ -81,7 +92,7 @@ let config = function (env) {
8192
})
8293
})
8394
}
84-
95+
8596
if (env) {
8697
if (typeof env.devserver !== 'undefined' && env.devserver) {
8798
returner.module.rules.push({
@@ -117,7 +128,7 @@ let config = function (env) {
117128
returner.plugins.push(new UglifyJsPlugin())
118129
}
119130
}
120-
131+
121132
return returner
122133
}
123134

0 commit comments

Comments
 (0)