I am trying to implement wow.js using reaction and webpack.
I install it through npm.
npm install --save wow.js
It installs perfectly. Now the problem is how to import it correctly. I can't get it to work while continuing to get undefined.
I tried several ways:
First of all:
import wow from 'wow.js';
But webpack cannot compile it. He says the module could not be found. Even i use full urlimport wow from /node_modules/wow.js
Secondly:
I am using this solution from here :
require('imports?this=>window!js/wow.js');
But I still can't find the modules (I am changing the path to my node_modules).
Third:
From here :
I use the exposure module and try to new WOW().init();say Wow is undefined.
, , html , bundle.js script.
. , ?
!
my webpack.config.js:
module.exports = {
entry: [
'webpack-dev-server/client?http://localhost:8080',
'bootstrap-loader',
'webpack/hot/only-dev-server',
'./src/js/index.js'
],
output: {
path: __dirname + "/build",
publicPath: "/build/",
filename: 'bundle.js'
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery"
})
],
module: {
loaders: [
{
exclude: /node_modules/,
loader: 'react-hot!babel'
},
{
test: /\.css$/,
loader: 'style!css!postcss'
},
{
test: /\.scss$/,
loader: 'style!css!postcss!sass'
},
{ test: /\.(woff2?|ttf|eot|svg|otf)$/, loader: 'url?limit=10000' },
{
test: 'path/to/your/module/wow.min.js',
loader: "expose?WOW"
}
]
},
resolve: {
extensions: ['', '.js', '.jsx']
},
devServer: {
historyApiFallback: true,
contentBase: './'
},
postcss: [autoprefixer]
};