{"id":13396927,"url":"https://github.com/ethul/purs-loader","last_synced_at":"2025-11-04T09:05:22.940Z","repository":{"id":21006086,"uuid":"24296709","full_name":"ethul/purs-loader","owner":"ethul","description":"PureScript loader for webpack","archived":false,"fork":false,"pushed_at":"2024-03-01T22:43:37.000Z","size":326,"stargazers_count":187,"open_issues_count":30,"forks_count":41,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-04-10T03:54:41.882Z","etag":null,"topics":["javascript","loader","purescript","purs-loader","webpack"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ethul.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-09-21T16:43:58.000Z","updated_at":"2024-04-29T11:02:10.893Z","dependencies_parsed_at":"2024-01-08T14:30:46.266Z","dependency_job_id":"ceb79e53-03e0-4b8e-978c-b0819b6549a0","html_url":"https://github.com/ethul/purs-loader","commit_stats":{"total_commits":176,"total_committers":17,"mean_commits":"10.352941176470589","dds":"0.19318181818181823","last_synced_commit":"4c3a7f7ae43a071190486612875ce3111922ea11"},"previous_names":[],"tags_count":60,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethul%2Fpurs-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethul%2Fpurs-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethul%2Fpurs-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethul%2Fpurs-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ethul","download_url":"https://codeload.github.com/ethul/purs-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305933,"owners_count":20917208,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","loader","purescript","purs-loader","webpack"],"created_at":"2024-07-30T18:01:07.911Z","updated_at":"2025-11-04T09:05:22.890Z","avatar_url":"https://github.com/ethul.png","language":"JavaScript","readme":"# purs-loader\n\n\u003e [PureScript](http://www.purescript.org) loader for [webpack](http://webpack.github.io)\n\n- Supports hot-reloading and rebuilding of single source files\n- Dead code elimination using the `bundle` option\n- Colorized build output using `purescript-psa` and the `psc: \"psa\"` option\n\n## Install\n\nInstall with [npm](https://npmjs.org/package/purs-loader).\n\n```\nnpm install purs-loader --save-dev\n```\n\n## Example\n\n```javascript\nconst webpackConfig = {\n  // ...\n  loaders: [\n    // ...\n    {\n      test: /\\.purs$/,\n      loader: 'purs-loader',\n      exclude: /node_modules/,\n      query: {\n        spago: true,\n        pscIde: true,\n        src: ['src/**/*.purs']\n      }\n    }\n    // ...\n  ]\n  // ...\n}\n```\n\nRefer to the [purescript-webpack-example](https://github.com/ethul/purescript-webpack-example) for a more detailed example.\n\n### Options\n\nDefault options:\n\n```javascript\nconst loaderConfig = {\n  psc: null, // purs compile\n  pscArgs: {},\n  pscBundle: null, // purs bundle\n  pscBundleArgs: {},\n  pscIde: false, // instant rebuilds using psc-ide-server (experimental)\n  pscIdeClient: null, // purs ide client\n  pscIdeClientArgs: {}, // for example, to use different port {port: 4088}\n  pscIdeServer: null, // purs ide server\n  pscIdeServerArgs: {}, // for example, to change the port {port: 4088}\n  pscIdeRebuildArgs: {}, // for example, for sourcemaps {codegen: ['js', 'sourcemaps']}\n  pscIdeColors: false, // defaults to true if psc === 'psa'\n  pscPackage: false, // include dependencies from psc-package\n  spago: false, // include dependencies from spago\n  bundleOutput: 'output/bundle.js',\n  bundleNamespace: 'PS',\n  bundle: false,\n  warnings: true,\n  watch: false, // indicates if webpack is in watch mode\n  output: 'output',\n  src: [\n    path.join('src', '**', '*.purs'),\n    // if pscPackage = true\n    // source paths reported by `psc-package sources`\n    // if spago = true\n    // source paths reported by `spago sources`\n    // if pscPackage = false and spago = false\n    path.join('bower_components', 'purescript-*', 'src', '**', '*.purs')\n  ]\n}\n```\n\n### `psc-ide` support (experimental)\n\nExperimental support for instant rebuilds using `psc-ide-server` can be enabled\nvia the `pscIde: true` option.\nYou can use an already running `psc-ide-server` instance by specifying the port in `pscIdeArgs`,\nif there is no server running this loader will start one for you.\n\n### `psc-package` support (experimental)\n\nSet `pscPackage` query parameter to `true` to enable `psc-package` support. The `psc-package`-supplied source paths\nwill be appended to `src` parameter.\n\n### `spago` support (experimental)\n\nSet `spago` query parameter to `true` to enable `spago` support. The `spago`-supplied source paths\nwill be appended to `src` parameter.\n\n### Troubleshooting\n\n#### Slower webpack startup after enabling psc-ide support?\n\nBy default, the psc-ide-server will be passed the globs from query.src, this is\nhelpful for other tools using psc-ide-server (for example IDE plugins), however\nit might result in a slower initial webpack startup time (rebuilds are not\naffected). To override the default behaviour, add:\n`pscIdeServerArgs: { \"_\": ['your/*globs/here'] }` to the loader config\n\n#### Errors not being displayed in watch mode?\n\nWhen the `watch` option is set to `true`, psc errors are appended to\nwebpack's compilation instance errors array and not passed back as an\nerror to the loader's callback. This may result in the error not being\nreported by webpack. To display errors, the following plugin may be added\nto the webpack config.\n\n```javascript\nconst webpackConfig = {\n  // ...\n  plugins: [\n    function(){\n      this.plugin('done', function(stats){\n        process.stderr.write(stats.toString('errors-only'));\n      });\n    }\n  ]\n  // ...\n}\n```\n\n#### Error `spawn ENOENT`\n\nThis is caused when the loader tries to spawn a binary that does not exists\n(`file or directory not found`). If you call webpack like `webpack` or\n`webpack --watch`, then ensure that all required binaries that the\nloader depends on are available in your `$PATH`. \n\nIf you run webpack through an npm script (e.g., npm run or npm start) on NixOS, \nthen it will first attempt to find binaries in `node_packages/.bin`. \nIf you have the compiler installed through `npm` and it finds it there, this will \ncause `ENOENT`on Nix, because [the binary needs to be patched first, but npm will \ninstall the binary that is linked with /lib64/ld-linux-x86-64.so.2 - a file that \nwill not exist at that path in NixOS](https://github.com/ethul/purescript-webpack-example/issues/5#issuecomment-282492131).\nThe solution is to simply use the compiler from `haskellPackages.purescript` and\nmake sure that it's available in `$PATH`. For more information about how to make \nit work on Nix, see [Purescript Webpack Example](https://github.com/ethul/purescript-webpack-example#using-globally-installed-binaries)\n","funding_links":[],"categories":["Tool and Package Manager","Build Tooling"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethul%2Fpurs-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fethul%2Fpurs-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethul%2Fpurs-loader/lists"}