{"id":15980524,"url":"https://github.com/drwpow/babel-plugin-import-pika-web","last_synced_at":"2025-04-04T18:44:39.770Z","repository":{"id":66331268,"uuid":"186310829","full_name":"drwpow/babel-plugin-import-pika-web","owner":"drwpow","description":"ESM import transformer for @pika/web","archived":false,"fork":false,"pushed_at":"2022-04-22T04:22:46.000Z","size":94,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-10T04:17:24.824Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/drwpow.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-05-12T22:29:42.000Z","updated_at":"2022-04-22T04:22:50.000Z","dependencies_parsed_at":"2023-02-20T19:45:46.042Z","dependency_job_id":null,"html_url":"https://github.com/drwpow/babel-plugin-import-pika-web","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drwpow%2Fbabel-plugin-import-pika-web","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drwpow%2Fbabel-plugin-import-pika-web/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drwpow%2Fbabel-plugin-import-pika-web/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drwpow%2Fbabel-plugin-import-pika-web/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drwpow","download_url":"https://codeload.github.com/drwpow/babel-plugin-import-pika-web/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234850,"owners_count":20905852,"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":[],"created_at":"2024-10-08T00:20:27.818Z","updated_at":"2025-04-04T18:44:39.746Z","avatar_url":"https://github.com/drwpow.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Import Pika Web\n\nA Babel plugin for transforming imports on files to ESM imports for\n[@pika/web][pika-web].\n\n```js\nimport preact from 'preact'; // Transforms this 🚫\nimport preact from './web_modules/preact.js'; // Into this ✅\n```\n\n## Installation\n\n```bash\nnpm i -D @babel/core babel-plugin-import-pika-web\n```\n\n## Usage\n\nAdd the following to `.babelrc`:\n\n```json\n{\n  \"plugins\": [\n    [\n      \"import-pika-web\",\n      {\n        \"dir\": \"dist/web_modules\",\n        \"ignore\": [\"jest\"]\n      }\n    ]\n  ]\n}\n```\n\nThis plugin will resolve all paths to a module relative to the web modules\nfolder set. Also, according to the ES spec, it will also add a `.js`\nextension to any extension-less imports.\n\n### Options\n\n| Name     | Default         | Description                                                                                                                                       |\n| :------- | :-------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `dir`    | `\"web_modules\"` | Location of the web modules. Should usually match the `--dest` option for @pika/web.                                                              |\n| `ignore` | `[]`            | Exact names of modules to ignore, if you find it transforming things it shouldn’t (e.g. `\"react\"` will match `\"react\"` but ignore `\"react-dom\"`). |\n\n### Using Babel CLI\n\nInstall the Babel CLI\n\n```\nnpm i -D @babel/cli\n```\n\nAnd add the following to `package.json`:\n\n```json\n{\n  \"scripts\": {\n    \"build\": \"npm run build:esm \u0026\u0026 npm run build:js\",\n    \"build:esm\": \"pika-web --dest dist/web_modules\",\n    \"build:js\": \"babel dist -d dist --ignore web_modules/*.js\"\n  },\n  \"@pika/web\": {\n    \"webDependencies\": [\"preact\", \"preact-router\"]\n  }\n}\n```\n\nCombine this with the `.babelrc` above, and run:\n\n```bash\nnpm run build\n```\n\n### Using webpack\n\nNo, silly! This _replaces_ webpack! It lets the browser handle code-splitting\nand optimizations! [Read this blog post][pika-web-blog] to learn more.\n\n## Examples\n\n[TypeScript + @pika/web][pika-web-preact]\n\n[pika-web]: https://github.com/pikapkg/web/\n[pika-web-blog]: https://www.pikapkg.com/blog/pika-web-a-future-without-webpack/\n[pika-web-preact]: https://github.com/dangodev/pika-web-preact\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrwpow%2Fbabel-plugin-import-pika-web","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrwpow%2Fbabel-plugin-import-pika-web","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrwpow%2Fbabel-plugin-import-pika-web/lists"}