I'm trying to migrate my application from requirejs to webpack 2 but i'm having trouble.
My webpack config :
rules: [
// rules for modules (configure loaders, parser options, etc.)
{
test: /\.jsx?$/,
include: [
path.resolve(__dirname, "src")
],
exclude: [
path.resolve(__dirname, "app/demo-files")
],
enforce: "pre",
enforce: "post",
},
{
test: /underscore/,
loader: 'expose-loader?_'
},
{
test: /howler/,
loader: 'expose-loader?Howl'
},
{
test: /pathfinding/,
loader: 'expose-loader?PF'
},
{
test: /stats/,
loader: 'expose-loader?Stats'
},
{
test: /datgui/,
loader: 'expose-loader?dat.gui'
},
{ test: /jquery/,
loader: 'imports?jQuery=jquery,$=jquery,this=>window'
},
{
test: /jquery-ui/,
use: [
'expose-loader?$',
'imports-loader?this=>window,jquery'
]
}
And in plugin section :
plugins: [
new webpack.ProvidePlugin({
"$":"libs/jquery/jquery.min",
"jQuery":"libs/jquery/jquery.min",
"window.jQuery":"libs/jquery/jquery.min"
}),
]
But when i do this i have the following error :
Game.js:48 Uncaught TypeError: $(...).tooltip is not a function
at Game.init (Game.js:48)
at Object.<anonymous> (init.js:6)
at Object.<anonymous> (init.js:7)
at __webpack_require__ (bootstrap aa1ecbe…:678)
Can you help me with this trouble ? I think the problem is with the import of jquery but i don't know how to resolve the issue...
Thanks