{"action":"opened","issue":{"url":"https://api.github.com/repos/froala/wysiwyg-editor/issues/2980","repository_url":"https://api.github.com/repos/froala/wysiwyg-editor","labels_url":"https://api.github.com/repos/froala/wysiwyg-editor/issues/2980/labels{/name}","comments_url":"https://api.github.com/repos/froala/wysiwyg-editor/issues/2980/comments","events_url":"https://api.github.com/repos/froala/wysiwyg-editor/issues/2980/events","html_url":"https://github.com/froala/wysiwyg-editor/issues/2980","id":343953780,"node_id":"MDU6SXNzdWUzNDM5NTM3ODA=","number":2980,"title":"Webpack (Encore) & KMS FroalaEditorBundle","user":{"login":"jmsche","id":3929498,"node_id":"MDQ6VXNlcjM5Mjk0OTg=","avatar_url":"https://avatars3.githubusercontent.com/u/3929498?v=4","gravatar_id":"","url":"https://api.github.com/users/jmsche","html_url":"https://github.com/jmsche","followers_url":"https://api.github.com/users/jmsche/followers","following_url":"https://api.github.com/users/jmsche/following{/other_user}","gists_url":"https://api.github.com/users/jmsche/gists{/gist_id}","starred_url":"https://api.github.com/users/jmsche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmsche/subscriptions","organizations_url":"https://api.github.com/users/jmsche/orgs","repos_url":"https://api.github.com/users/jmsche/repos","events_url":"https://api.github.com/users/jmsche/events{/privacy}","received_events_url":"https://api.github.com/users/jmsche/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-24T09:21:12Z","updated_at":"2018-07-24T09:21:12Z","closed_at":null,"author_association":"NONE","body":"##### Expected behavior.\r\nPack everything using Webpack Encore to reduce HTTP calls & data transfer.\r\n\r\n##### Actual behavior.\r\nDoes not work; jQuery & `froalaEditor` are not accessible from outside the webpack config/app.js file.\r\n\r\n##### Steps to reproduce the problem.\r\nHi,\r\n\r\nI currently use the KMSFroalaEditorBundle. I put the issue here as I think it is more a Froala issue than a KMS one.\r\nBy default, for each editor created by the bundle, everything is loaded several times (jQuery, Froala JS, each plugin...). That means the page may take several seconds to load due to this default configuration.\r\nLoading the editor is done \"externally\" in the template (see https://github.com/froala/KMSFroalaEditorBundle/blob/master/Resources/views/Form/froala_widget.html.twig#L62-L94).\r\nTo avoid this, I try to reduce HTTP calls/load by packing everything using Webpack Encore (a wrapper for Webpack), using this configuration:\r\n\r\n```js\r\n// webpack.config.js\r\nlet Encore = require('@symfony/webpack-encore');\r\nlet HardSourceWebpackPlugin = require('hard-source-webpack-plugin');\r\n\r\nEncore\r\n    .setOutputPath('public/build/')\r\n    .setPublicPath('/build')\r\n    .cleanupOutputBeforeBuild()\r\n    .enableSourceMaps(!Encore.isProduction())\r\n    .enableVersioning(Encore.isProduction())\r\n    .enableBuildNotifications()\r\n\r\n    .addEntry('app', './assets/js/app.js')\r\n    .enableSassLoader()\r\n    .autoProvidejQuery()\r\n    .autoProvideVariables({\r\n        '_': 'underscore',\r\n        Backbone: 'backbone',\r\n    })\r\n\r\n    .addPlugin(new HardSourceWebpackPlugin())\r\n;\r\n\r\nmodule.exports = Encore.getWebpackConfig();\r\n```\r\n\r\n```js\r\n// assets/js/app.js\r\nrequire('jquery');\r\n\r\n// Froala\r\nimport 'froala-editor/js/froala_editor.pkgd.min.js';\r\nimport 'froala-editor/js/languages/fr.js';\r\n```\r\n\r\nDo you have any idea how I could fix that?\r\n\r\nThanks\r\n\r\n##### OS.\r\nN/A\r\n\r\n##### Browser.\r\nN/A\r\n"}}
{"actor":{"display_login":"jmsche"}}