I do not want to expose the jQuery object to the global window object which is available in the browser within the Developer Console. Now in my webpack config I have the following lines:
plugins: [new webpack.ProvidePlugin ({$: 'jQuery', jQuery: 'jQuery'})]
These lines add jQuery definitions to each file in my webpack module. But when I create a project and try to use jQuery in the Developer Console like this:
window. $; Window.jQuery;
It says that these properties are undefined ...
Is there any way to fix this?
You need to use it.
NPM Exposure Loader --save-dev
You can do this when you need it:
< Code> Required ("Explain? $! Jquery");
Or you can do this in your config:
Loader: [{test: require.resolve ('jquery'), loader: 'expos ? According to WebPack 2, you must use instead of using Exposure Loader : Module: {Rule: [{test: require.resolve ('jquery'), use: [[loader: 'expose-loader', option: '$'}]}]}
No comments:
Post a Comment