mirror of
https://github.com/Doodle3D/Doodle3D-Core.git
synced 2024-12-22 02:53:50 +01:00
add cordova support
This commit is contained in:
parent
e3937f3486
commit
ac78534f06
8
.gitignore
vendored
8
.gitignore
vendored
@ -5,3 +5,11 @@ lib
|
||||
module
|
||||
|
||||
node_modules
|
||||
|
||||
www
|
||||
|
||||
plugins
|
||||
|
||||
platforms
|
||||
|
||||
config.xml
|
||||
|
@ -1 +1,9 @@
|
||||
node_modules
|
||||
|
||||
www
|
||||
|
||||
plugins
|
||||
|
||||
platforms
|
||||
|
||||
config.xml
|
||||
|
12
index.js
12
index.js
@ -49,10 +49,16 @@ import React from 'react';
|
||||
import { Provider } from 'react-redux';
|
||||
import { render } from 'react-dom';
|
||||
import App from './src/components/App.js';
|
||||
import sketcherReducer from './src/reducer/index.js';
|
||||
|
||||
render((
|
||||
async function init() {
|
||||
if (process.env.TARGET === 'app') {
|
||||
await new Promise(resolve => document.addEventListener('deviceready', resolve, false));
|
||||
}
|
||||
|
||||
render((
|
||||
<Provider store={store}>
|
||||
<App />
|
||||
</Provider>
|
||||
), document.getElementById('app'));
|
||||
), document.getElementById('app'));
|
||||
}
|
||||
init();
|
||||
|
3378
package-lock.json
generated
3378
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -7,6 +7,7 @@
|
||||
"esnext": "src",
|
||||
"scripts": {
|
||||
"start": "webpack-dev-server -w",
|
||||
"ios": "TARGET=app webpack -p && cordova run ios",
|
||||
"prepare": "npm run build",
|
||||
"build": "npm run build:main && npm run build:module ",
|
||||
"build:main": "BABEL_ENV=main babel src -s -d lib",
|
||||
@ -47,7 +48,6 @@
|
||||
"valid-url": "^1.0.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"webpack-bundle-analyzer": "^2.9.1",
|
||||
"babel-cli": "6.24.1",
|
||||
"babel-core": "6.24.1",
|
||||
"babel-loader": "^7.0.0",
|
||||
@ -64,6 +64,7 @@
|
||||
"babel-preset-es2015": "6.24.1",
|
||||
"babel-preset-react": "^6.24.1",
|
||||
"babel-preset-stage-0": "^6.24.1",
|
||||
"cordova": "^7.1.0",
|
||||
"css-loader": "^0.28.7",
|
||||
"file-loader": "^1.1.5",
|
||||
"html-webpack-plugin": "^2.30.1",
|
||||
@ -80,6 +81,8 @@
|
||||
"redux-thunk": "^2.2.0",
|
||||
"style-loader": "^0.19.0",
|
||||
"webpack": "^3.8.1",
|
||||
"webpack-bundle-analyzer": "^2.9.1",
|
||||
"webpack-cordova-plugin": "^0.1.6",
|
||||
"webpack-dev-server": "^2.9.4",
|
||||
"worker-loader": "^1.1.0",
|
||||
"yml-loader": "^2.1.0"
|
||||
|
@ -1,8 +1,11 @@
|
||||
const webpack = require('webpack');
|
||||
const path = require('path');
|
||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||
const HTMLWebpackPlugin = require('html-webpack-plugin');
|
||||
const CordovaPlugin = require('webpack-cordova-plugin');
|
||||
|
||||
const devMode = process.env.NODE_ENV !== 'production';
|
||||
const appMode = process.env.TARGET === 'app';
|
||||
|
||||
const babelLoader = {
|
||||
loader: 'babel-loader',
|
||||
@ -74,13 +77,26 @@ module.exports = {
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': {
|
||||
'TARGET': JSON.stringify(process.env.TARGET)
|
||||
}
|
||||
}),
|
||||
new HTMLWebpackPlugin({
|
||||
title: 'Doodle3D Core - Simple example',
|
||||
template: require('html-webpack-template'),
|
||||
inject: false,
|
||||
scripts: appMode ? ['cordova.js'] : null,
|
||||
appMountId: 'app'
|
||||
}),
|
||||
// new BundleAnalyzerPlugin()
|
||||
...(appMode ? [
|
||||
new CordovaPlugin({
|
||||
config: 'config.xml',
|
||||
src: 'index.html',
|
||||
platform: 'ios',
|
||||
version: true
|
||||
})
|
||||
] : [])
|
||||
],
|
||||
devtool: "source-map",
|
||||
devServer: {
|
||||
|
Loading…
Reference in New Issue
Block a user