Search code examples
jquerylinuxmacosowl-carousel-2webpack-encore

e.owlCarousel is not a function after yarn encore production on linux host


I have symfony 4 app with webpack-encore and yarn. And seems that won't build correctly on linux host but works fine after bulding on macos

Here is part of my app.js

styles...
const $ = require('jquery');
require('jquery-ui');
require('bootstrap');
require('owl.carousel');
other JS...

and webpack config

const Encore = require('@symfony/webpack-encore');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
Encore
    .setOutputPath('public/build/')
    .setPublicPath('/build')
    .addEntry('app', './assets/js/app.js')
    .autoProvideVariables({
        $: 'jquery',
        jQuery: 'jquery',
        'window.jQuery': 'jquery',
    })
    .addPlugin(new CaseSensitivePathsPlugin())
    .cleanupOutputBeforeBuild()
    .enableBuildNotifications()
    .enableSourceMaps(!Encore.isProduction())
    .enableVersioning(Encore.isProduction())

    .configureBabel(() => {
    }, {
        useBuiltIns: 'usage',
        corejs: 3
    })
;
module.exports = Encore.getWebpackConfig();

Solution

  • Problem has been solved using npm install instead yarn install. Seems dependencies was linked incorrectly with yarn