i am having problem with implementing jquery 3rd party plugins in symfony webpack encore. so far i have several .js files with varous logic, and also some scripts inside twig files that execute some of js.
this is app.js :
var $ = require('jquery');
global.$ = global.jQuery = global.jquery = $;
require('jquery-validation');
webpack compiles, but when i execute program i get:
$(...).validate is not a function
webpack.config.js is straightforward:
var Encore = require('@symfony/webpack-encore');
Encore
// directory where compiled assets will be stored
.setOutputPath('public/build/')
// public path used by the web server to access the output path
.setPublicPath('/build')
.setManifestKeyPrefix('build/')
.addEntry('base', './assets/js/base.js')
.splitEntryChunks()
.enableSingleRuntimeChunk()
;
module.exports = Encore.getWebpackConfig();
package.json:
"jquery": "^3.3.1",
"jquery-validation": "^1.18.0",
"jquery-datetimepicker": "^2.5.20",
update: jquery-datetimepicker is working fine, but jquery-validation is not!