purs-loader icon indicating copy to clipboard operation
purs-loader copied to clipboard

Compiles but does not execute anything

Open GCrispino opened this issue 5 years ago • 2 comments

Hi! I've set up an example project with pulp init with purs version 13 and pulp version 13.0.0 to try to get purs-loader to work. It compiles with no errors but the bundled code does not execute anything. These are my devDependecies in package.json:

{
  ...
  "devdependencies": {
    "psa": "^1.0.0",
    "purescript": "^0.13.2",
    "purs-loader": "^3.6.0",
    "webpack": "^4.39.1",
    "webpack-cli": "^3.3.6",
    "webpack-dev-server": "^3.7.2"
  }
  ...
}

I'm using the webpack.config.js from the purescript-webpack-example repository.

The project contains just a simple hello world log statement, but if you want to take a look I created this repository.

GCrispino avatar Aug 04 '19 21:08 GCrispino

I believe that you just need to run your effect using something like unsafePerformEffect.

ethul avatar Aug 17 '19 16:08 ethul

That worked! Just now I realized that the example in purescript-webpack-example is written this way, I'm sorry... But if I can ask, why does it have to be this way? When using pulp we just have to declare main as a function that returns a Effect Unit, without having to use unsafePerformEffect.

GCrispino avatar Aug 19 '19 00:08 GCrispino