I'm using vue-cli with webpack and Laravel. Loading js files like jQuery from cdn in my app.blade.php is working but i don't want to include my files from cdns...
using
require('@/js/assets/jquery.js');
in app.js is not working. When a look at the complied app.js in my browser it seems that jQUery is imported but i have an error saying "$ is undefined".
This is the same for every js /css files i'm trying to add in my vue app.
app.blade.php :
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{csrf_token()}}">
<title>MTM</title>
<link href=" {{ asset('css/app.css') }}" rel="stylesheet">
</head>
<body>
<div id="app">
<app></app>
</div>
<script src="{{ asset('js/app.js') }}"></script>
</body>
</html>
webpack.mix.js:
const mix = require('laravel-mix');
mix.webpackConfig({
resolve:{
extensions:['.js','.vue'],
alias:{
'@': __dirname + '/resources'
}
}
})
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css');
app.js
require('@/css/Semantic-UI-CSS-master/semantic.css');
require('@/js/assets/jQuery.js');
require('@/js/assets/semantic.js');
require('@/js/assets/tablesort.js');