@phpmick You should be writing your JS within the "strict" mode standards. So, I wouldn't remove it. Instead, refactor the code to comply. Webpack enforces the JS "use strict" because it is the common standard.
Remove user strict? Mix.
I am getting this error when mixing:
SyntaxError: Deleting local variable in strict mode (452:49)
How can I do this in Laravel Mix?
I think I need to do something like this?;
Mick
Agreed, but it's not my code. It's a charting library.
I guess I can remove it from the mix and just use reference it on the page directly.
Mick
I commented the line out in my webpack.mix.js and now get this:
ERROR Failed to compile with 30 errors
These dependencies were not found in node_modules:
* /u10/html/dashboard-project/resources/assets/js/dataTables.keytable.min.js
* datatables.net
* datatables.net
* datatables.net
* datatables.net
* datatables.net
* datatables.net-buttons
* datatables.net-buttons
* datatables
* jquery-ui/data
* jquery-ui/disable-selection
* jquery-ui/focusable
* jquery-ui/form
* jquery-ui/ie
* jquery-ui/keycode
* jquery-ui/labels
* jquery-ui/jquery-1-7
* jquery-ui/plugin
* jquery-ui/safe-blur
* jquery-ui/scroll-parent
* jquery-ui/tabbable
* jquery-ui/unique-id
* jquery-ui/version
* jquery-ui/widget
* jquery-ui/safe-active-element
* jquery-ui/widgets/mouse
* jquery-ui/widgets/draggable
* jquery-ui/widgets/droppable
* jquery-ui/widgets/resizable
* datatables.net
This is my webpack.mix.js:
const { mix } = require('laravel-
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
mix.js([
'resources/assets/js/app.js',
'resources/assets/js/jquery-3.1.1.js',
'resources/assets/js/jquery-ui.js',
'resources/assets/js/lodash.js',
//'resources/assets/js/fusioncharts.js',
'resources/assets/js/fusioncharts.charts.js',
'resources/assets/js/fusioncharts.widgets.js',
'resources/assets/js/fusioncharts.theme.fint.js',
'resources/assets/js/fusioncharts-jquery-plugin.js',
'resources/assets/js/gridstack.min.js',
'resources/assets/js/vue.js',
'resources/assets/js/jquery.dataTables.js',
'resources/assets/js/dataTables.buttons.min.js',
'resources/assets/js/dataTables.select.min.js',
'resources/assets/js/dataTables.keytable.min.js',
'resources/assets/js/dataTables.editor.js',
'resources/assets/js/jszip.min.js',
'resources/assets/js/pdfmake.min.js',
'resources/assets/js/vfs_fonts.js',
'resources/assets/js/buttons.html5.min.js',
'resources/assets/js/buttons.print.min.js',
'resources/assets/js/dataTables.responsive.min.js',
'resources/assets/js/dataTables.bootstrap.min.js',
'resources/assets/js/axios.js'
],'public/js')
.sass('resources/assets/sass/app.scss', 'public/css');
Any idea what I am doing wrong?
Mick
I'm doing mix.combine now. Mix is running OK.
Now I am getting:
Uncaught Error: Cannot find module "jquery-ui/data"
at webpackMissingModule (app.js:27735)
When I load the page.
@phpMick Did you see my post on including jquery-ui with webpack? It's really simple.
So, to get webpack to take jquery-ui, you must use the jquery-ui-dist package. In bootstrap.js and after bootstarp-sass write require('jquery-ui');. In webpack.mix.js, you need to place an alias to attach to the default webpack config like this:
mix.webpackConfig({
resolve: {
alias: {
'jquery-ui': 'jquery-ui-dist/jquery-ui.js'
}
}
});
Place that before you call mix.js(). It will be bundled by webpack.
The problem with most packages is they are not built for webpack. So, you search for a bundle build and use it like above.
Thanks, I've dropped backed to 5.3 for now.
Will come back to this, when I have some time.
Please or to participate in this conversation.