ardatan / meteor-webpack

https://medium.com/@ardatan/meteor-with-webpack-in-2018-faster-compilation-better-source-handling-benefit-from-bc5ccc5735ef
MIT License
123 stars 29 forks source link

Cordova:HCP Issue #82

Open informedecommerce opened 4 years ago

informedecommerce commented 4 years ago

Latest versions of everything as of 12/26/19 Stack: Meteor 1.8.2 Vue Cordova

We are getting what appears to be build.js not found on native devices. HCP works as expected in browser.

initial app(ios and android) load works, but subsequent loads fail by returning the cordova index.html html as the build.js file content.

After doing research it seems that cordova will return the index.html file as the missing requested file.

The flagging error is "Uncaught SyntaxError: Unexpected token <" due to the compiler looking for javascript and receiving html.

This issue is non-device specific, not does server deploy or build affect it. Run on local, production server, and development server all have this behavior.

Have tried all the standards. Meteor reset NPM update Verified codebase is matching to server build etc...

Just curious if anyone else has run into this or has any solutions.

.meteor/packages cordova-plugin-device@2.0.3 cordova-plugin-inappbrowser@3.1.0 cordova-plugin-splashscreen@5.0.3

.meteor/cordova_-plugins cordova-plugin-device@2.0.3 cordova-plugin-inappbrowser@3.1.0 cordova-plugin-splashscreen@5.0.3

.meteor/versions accounts-base@1.4.5 accounts-password@1.5.2 accounts-ui@1.3.1 accounts-ui-unstyled@1.4.2 agile:agile-core@0.0.1 akryum:vue-component@0.15.1 akryum:vue-component-dev-client@0.4.7 akryum:vue-component-dev-server@0.1.4 allow-deny@1.1.0 ardatan:webpack@0.0.13 ardatan:webpack-dev-middleware@0.0.13 autoupdate@1.6.0 babel-compiler@7.4.1 babel-runtime@1.4.0 base64@1.0.12 binary-heap@1.0.11 blaze@2.3.4 blaze-tools@1.0.10 boilerplate-generator@1.6.0 browser-policy@1.1.0 browser-policy-common@1.0.11 browser-policy-content@1.1.0 browser-policy-framing@1.1.0 caching-compiler@1.2.1 caching-html-compiler@1.1.3 callback-hook@1.2.0 check@1.3.1 coffeescript@1.0.17 ddp@1.4.0 ddp-client@2.3.3 ddp-common@1.4.0 ddp-rate-limiter@1.0.7 ddp-server@2.3.0 deps@1.0.12 diff-sequence@1.1.1 dynamic-import@0.5.1 ecmascript@0.13.1 ecmascript-runtime@0.7.0 ecmascript-runtime-client@0.9.0 ecmascript-runtime-server@0.8.0 ejson@1.1.0 email@1.2.3 es5-shim@4.8.0 fetch@0.1.1 geojson-utils@1.0.10 hot-code-push@1.0.4 html-tools@1.0.11 htmljs@1.0.11 http@1.4.2 id-map@1.1.0 inter-process-messaging@0.1.0 jquery@1.11.11 launch-screen@1.1.1 less@2.8.0 littledata:synced-cron@1.5.1 livedata@1.0.18 localstorage@1.2.0 logging@1.1.20 meteor@1.9.3 meteor-base@1.4.0 minifier-css@1.4.3 minifier-js@2.5.1 minimongo@1.4.5 mizzao:timesync@0.5.1 mizzao:user-status@0.6.8 mobile-experience@1.0.5 mobile-status-bar@1.0.14 modern-browsers@0.1.4 modules@0.14.0 modules-runtime@0.11.0 momentjs:moment@2.24.0 mongo@1.7.0 mongo-decimal@0.1.1 mongo-dev-server@1.1.0 mongo-id@1.0.7 npm-bcrypt@0.9.3 npm-mongo@3.2.0 observe-sequence@1.0.16 ordered-dict@1.1.0 promise@0.11.2 random@1.1.0 rate-limit@1.0.9 reactive-dict@1.3.0 reactive-var@1.0.11 reload@1.3.0 retry@1.1.0 routepolicy@1.1.0 service-configuration@1.0.11 session@1.2.0 sha@1.0.9 shell-server@0.4.0 socket-stream-client@0.2.2 spacebars@1.0.15 spacebars-compiler@1.1.3 srp@1.0.12 standard-minifier-css@1.5.4 standard-minifier-js@2.5.2 tarang:ssl@1.0.1 templating@1.3.2 templating-compiler@1.3.3 templating-runtime@1.3.2 templating-tools@1.1.2 tracker@1.2.0 underscore@1.0.10 url@1.2.0 webapp@1.7.5 webapp-hashing@1.0.9

webpack.config `var path = require('path') var webpack = require('webpack') const HtmlWebpackPlugin = require('html-webpack-plugin'); const VueLoaderPlugin = require('vue-loader/lib/plugin') const meteorExternals = require('webpack-meteor-externals');

const clientConfig = { entry: './client/main.js', output: { publicPath: path.resolve(__dirname, 'www'), filename: 'build.js' }, module: { rules: [{ test: /.css$/, use: [ 'vue-style-loader', 'css-loader' ], }, { test: /.vue$/, loader: 'vue-loader', options: { loaders: {} // other vue-loader options go here } }, { test: /.js$/, loader: 'babel-loader', exclude: /node_modules/ }, { test: /.(png|jpg|gif|svg)$/, loader: 'file-loader', options: { name: '[name].[ext]?[hash]' } }, { test: /.s(c|a)ss$/, use: [ 'vue-style-loader', 'css-loader', { loader: 'sass-loader', options: { implementation: require('sass'), fiber: require('fibers'), indentedSyntax: true // optional } } ] } ] }, resolve: { alias: { 'vue$': 'vue/dist/vue.esm.js' }, extensions: ['*', '.js', '.vue', '.json', '.scss', '.css', '.sass'] }, externals: [meteorExternals()], devServer: { contentBase: path.join(__dirname, 'public'), historyApiFallback: true, noInfo: true, overlay: true, hot: true }, performance: { hints: false }, devtool: '#eval-source-map', plugins: [ new webpack.HotModuleReplacementPlugin(), new HtmlWebpackPlugin({ template: './client/main.html' }), new VueLoaderPlugin() ] }

const serverConfig = { entry: './server/main.js', target: 'node', externals: [meteorExternals()], devServer: { hot: true, headers: { "Access-Control-Allow-Origin": "", "Access-Control-Allow-Origin": "http://", "Access-Control-Allow-Origin": "https://", 'Access-Control-Allow-Headers': '', 'Access-Control-Allow-Methods': '*', } }, };

module.exports = [clientConfig, serverConfig];`

Dependencies and versions "@babel/runtime": "^7.7.6", "@mdi/font": "^3.9.97", "babel-core": "^6.26.3", "babel-loader": "^7.1.5", "babel-preset-env": "^1.6.1", "babel-preset-stage-3": "^6.24.1", "bcrypt": "^3.0.7", "cross-env": "^5.2.1", "css-loader": "^2.1.1", "fibers": "^4.0.2", "file-loader": "^1.1.11", "html-webpack-plugin": "^3.2.0", "meteor-node-stubs": "~0.2.0", "npm": "^6.13.4", "sass": "^1.23.7", "sass-loader": "^7.3.1", "vue": "^2.6.11", "vue-loader": "^15.7.2", "vue-meta": "^0.5.3", "vue-meteor-tracker": "^1.0.3", "vue-router": "^3.1.3", "vue-style-loader": "^4.1.2", "vue-template-compiler": "^2.6.11", "vuetify": "^2.1.14", "vuex": "^3.1.2", "vuex-router-sync": "^5.0.0", "webpack": "^4.41.2", "webpack-dev-middleware": "^3.7.2", "webpack-hot-middleware": "^2.25.0", "webpack-meteor-externals": "0.0.4"