From 16c345d50fb0eebf68082d4cc1e2ff25b7089dce Mon Sep 17 00:00:00 2001 From: Sofia Sousa Date: Fri, 16 Nov 2018 18:06:50 +0000 Subject: [PATCH] feat: Remove jquery from externals --- README.md | 3 +-- package.json | 1 + src/js/init/wp.js | 4 +++- webpack.config.js | 1 - 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6ecb6a5..19adf53 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ module.exports = { } ``` -GutenbergJS expects to find React (v16.4.1), ReactDOM (v16.4.1), moment (v2.22.1), jQuery (v1.12.4) and lodash (v4.17.5) libraries in the environment it runs. Maybe you would add the following lines to your pages. +GutenbergJS expects to find React (v16.4.1), ReactDOM (v16.4.1), moment (v2.22.1) and lodash (v4.17.5) libraries in the environment it runs. Maybe you would add the following lines to your pages. ```html @@ -73,7 +73,6 @@ GutenbergJS expects to find React (v16.4.1), ReactDOM (v16.4.1), moment (v2.22.1 - ``` [↑ Go up to Table of contents](#table-of-contents) diff --git a/package.json b/package.json index 6f0a138..d3c62b2 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "@wordpress/url": "2.3.0", "@wordpress/viewport": "^2.0.11", "@wordpress/wordcount": "^2.0.3", + "jquery": "^3.3.1", "tinymce": "4.8.0" }, "devDependencies": { diff --git a/src/js/init/wp.js b/src/js/init/wp.js index 909e47f..237b33c 100644 --- a/src/js/init/wp.js +++ b/src/js/init/wp.js @@ -1,3 +1,6 @@ +import jQuery from 'jquery'; + +window.jQuery = window.jQuery || jQuery; window.wp = window.wp || {}; // User settings @@ -8,7 +11,6 @@ window.userSettings = window.userSettings || { }; // API settings - window.wpApiSettings = window.wpApiSettings || {}; window.wpApiSettingsroot = window.wpApiSettings.root || window.location.origin; window.wpApiSettingsnonce = window.wpApiSettings.nonce || '123456789'; diff --git a/webpack.config.js b/webpack.config.js index 52c8105..7a8746f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -33,7 +33,6 @@ const externals = { react: 'React', 'react-dom': 'ReactDOM', moment: 'moment', - jquery: 'jQuery', lodash: 'lodash', 'lodash-es': 'lodash', };