我有一个用Laravel 5.5和VueJS 2.7.12构建的Web应用程序。我们正在使用Laravel Mix来混合大多数资产,因此我们正在使用Webpack 3.12.0
我们使用GoNative来构建移动本机应用程序。我们的IOS应用正在运行,但我们的android构建未加载。我正在调试构建,这就是我看到的:
语法错误[在app.js Jquery中,$未定义。
还有我在页脚中遇到的其他一些错误
我真的无法在控制台中看到源代码来查看语法错误在哪里,但是我仍然想问是否有人遇到不兼容问题。昨天,我尝试将babel升级到最新版本,并安装了babel-presets-vue,但是并没有看到太多改进。
我没有使用babel loader,现在我将尝试使用。
我正在使用在Webpack.mix.js中提取jquery的方法
const { mix } = require('laravel-mix');
/*
|-------------------------------------------------------------------- ------
| Mix Asset Management */
if (mix.inProduction()) {
mix.version();
}
mix.copyDirectory([
'resources/assets/vendor/ampleadmin/plugins/bower_components/ckeditor'],
'public/js/ckeditor'
);
mix.copy(['resources/assets/vendor/ampleadmin/plugins/bower_components/jquery/dist/jquery.min.js','resources/assets/vendor/ampleadmin/js/custom.min.js,'resources/assets/vendor/ampleadmin/js/dashboard1.js','resources/assets/vendor/ampleadmin/plugins/bower_components/raphael/raphael-min.js', 'resources/assets/vendor/ampleadmin/plugins/bower_components/morrisjs/morris.min.js','resources/assets/vendor/ampleadmin/js/cbpFWTabs.js'], 'public/js');
mix.js('resources/assets/js/app.js', 'public/js')
.extract(['vue', 'jquery', 'axios', 'moment', 'laravel-echo', 'pusher-js']).version();
mix.autoload({
jquery: ['$', 'window.jQuery', 'jQuery'],
moment: 'moment',
DataTable : 'datatables.net-bs'
});
mix.sourceMaps();
// mix.options();
mix.options({
// extractVueStyles: false,
processCssUrls: false
// postCss: [require('autoprefixer')],
});
mix.webpackConfig({
resolve: {
alias: {
'vue$': 'vue/dist/vue.min.js',
'jquery-ui': 'jquery-ui-dist/jquery-ui.js',
}
}
});
这是我在package.json中的依赖项列表
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"babel": {
"plugins": [
"jsx-event-modifiers",
"transform-vue-jsx"
],
"ignore": [],
"presets": [
[
"env",
{
"targets": {
"node": "current"
}
}
],
"vue"
]
},
"devDependencies": {
"@ckeditor/ckeditor5-build-classic": "^10.1.0",
"axios": "^0.17",
"babel-preset-env": "^1.7.0",
"babel-preset-vue": "^2.0.2",
"bootstrap": "^3.3.7",
"bootstrap-sass": "^3.3.7",
"chartist": "^0.9.7",
"cross-env": "^5.2.0",
"datatables.net": "^1.10.19",
"datatables.net-bs": "^1.10.19",
"file-loader": "^1.1.11",
"imports-loader": "^0.8.0",
"jquery": "^3.3.1",
"jquery-migrate": "3.0.0",
"jquery-noconflict": "^1.0.0",
"jquery-ui": "^1.12.1",
"jquery-ui-dist": "^1.12.1",
"laravel-mix": "^1.7.2",
"less": "^3.8.0",
"less-loader": "^4.1.0",
"lodash": "^4.17.10",
"moment-timezone": "^0.5.21",
"quill": "^1.3.6",
"raphael": "^2.2.7",
"sass-loader": "^5.0.1",
"style-loader": "^0.17.0",
"toastr": "^2.1.4",
"vue": "^2.5.17",
"vue-loader": "^12.2.2",
"vue-resource": "^1.5.1",
"vuex": "^3.0.1",
"webpack-cli": "^2.1.5"
},
"dependencies": {
"api-ai-javascript": "^2.0.0-beta.14",
"apiai": "^4.0.3",
"babel": "^6.23.0",
"bootstrap": "^3.3.7",
"bootstrap-loader": "^2.2.0",
"bootstrap-select": "^1.13.1",
"browser-sync": "^2.24.6",
"buble": "^0.15.2",
"buble-loader": "^0.4.1",
"daterangepicker": "^3.0.3",
"express": "^4.15.3",
"file-loader": "^1.1.11",
"fs": "0.0.1-security",
"fullcalendar": "^3.9.0",
"fullcalendar-scheduler": "^1.9.4",
"gulp-sass": "^3.1.0",
"icheck": "^1.0.2",
"image-picker": "^0.3.1",
"install": "^0.10.4",
"ioredis": "^2.5.0",
"jquery-slimscroll": "^1.3.8",
"jquery-ui-touch-punch": "^0.2.3",
"laravel-echo": "^1.4.0",
"moment": "^2.22.2",
"morris.js": "^0.5.0",
"node-sass": "^4.9.2",
"npm": "^5.10.0",
"pusher-js": "^4.2.1",
"select2": "^4.0.6-rc.1",
"socket.io": "^1.7.4",
"timepicker": "^1.11.12",
"vue-bootstrap-toggle": "^1.1.4",
"vue-chat-scroll": "^1.3.3",
"vue-js-modal": "^1.3.16",
"vue-router": "^3.0.1",
"vue-select": "^2.4.0",
"vue-template-compiler": "^2.5.17",
"webpack": "^3.12.0"
}
}