I've a legacy application written in coffeescript and want to use webpack to bundle the project.
The goal is to use webpack without impacting the current code.
I've global functions in file functions.coffee that is used all over the application. Now I want to compile the project without using import in each module.
Any idea how can I achieve this?
I tried using imports-loader like below:
module: {
loaders: [
{
test: /\.coffee$/,
loader: 'coffee-loader'
},
{
test: require.resolve("./src/coffee/functions.coffee"),
use: "imports-loader?this=>window"
}
]
}
However, it seems that imports-loader doesn't recognize Coffeescript. I get the following error:
error: regular expressions cannot begin with *
/*** IMPORTS FROM imports-loader ***/
^
L0: /*** IMPORTS FROM imports-loader ***/