I want to be able to execute this line of code from deep within my program (compiled native code in Elm in practise)
var codec = msgpack.createCodec();
Before trying to switch to Webpack I simply had a script tag pointing to msgpack-lite. Would that still work, and if so, where should I put the .min.js file so that it can be found.
I've also tried putting it in index.js
var msgpack = require("msgpack-lite");
var Elm = require('./Main');
var elm = Elm.Main.fullscreen()
But it could not find it. And following Define global variable with webpack I tried this in webpack.config.js
resolve: {
modulesDirectories: ['node_modules'],
extensions: ['', '.js', '.elm', '.scss'],
alias: {
'msgpack': require('msgpack-lite')
}
},
module: {
loaders: [
{
test: /\.html$/,
exclude: /node_modules/,
loader: 'file?name=[name].[ext]'
},
{
test: /\.elm$/,
exclude: [/elm-stuff/, /node_modules/],
loader: 'elm-hot!elm-webpack'
// loader: 'elm-hot!elm-webpack?cwd=' + elmSource
},
{
test: /\.scss$/,
exclude: [/elm-stuff/, /node_modules/],
loaders: ["style-loader", "css-loader", "sass-loader"]
}
],
noParse: /\.elm$/
},
plugins: [
new webpack.ProvidePlugin({
'msgpack': 'msgpack'
})
],
but again with no success