Closed s0By closed 6 years ago
@s0By is $ jQuery?
Yes.
webpack.config.js
var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry: {
vendor: "./vendor.js"
},
output: {
path: __dirname + "/public/assets/vendor",
filename: "[name].min.js"
},
resolve: {
alias: {
'fileuploader': './public/assets/plugins/fileuploader/src/jquery.fileuploader.js' // relative to node_modules
}
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jquery: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
moment: 'moment',
Popper: ['popper.js', 'default']
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new ExtractTextPlugin("[name].min.css")
],
module: {
loaders: [
{
test: require.resolve('jquery'),
use: [{
loader: 'expose-loader',
options: 'jQuery'
},{
loader: 'expose-loader',
options: '$'
}]
}
]
}
};
and entry is
require('bootstrap');
require('fileuploader');
@s0By what is the error in the console? $.fileuploader.getInstance
only this?
Initialization with my config works fine, I see the files. But I have a separate buttons that worked through API before, and those give me Uncaught TypeError: $.fileuploader.getInstance is not a function
Fixed
Seems that the plugin is not module compatible at the moment. Isn't really friendly with Webpack, for example.
I managed to make it work a little bit.
$.fileuploader
and inner stuff ($.fileuploader.getInstance
for example) are not reachable.