# @open-wc/webpack-import-meta-loader

> Webpack configuration following open-wc recommendations

Latest version **0.4.7** (published 2020-05-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @open-wc/webpack-import-meta-loader
pnpm add @open-wc/webpack-import-meta-loader
yarn add @open-wc/webpack-import-meta-loader
bun add @open-wc/webpack-import-meta-loader
```

## Health

**Score 33/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.4.7 |
| Published | 2020-05-25 |
| First published | 2019-01-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/open-wc__webpack-import-meta-loader) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2399 |
| Author | open-wc |
| Maintainers | d4kmor, larsdenbakker |
| Keywords | webpack, meta-loader, import-meta |

## Links

- npm: https://www.npmjs.com/package/@open-wc/webpack-import-meta-loader
- Repository: https://github.com/open-wc/open-wc
- Homepage: https://github.com/open-wc/open-wc/tree/master/packages/webpack-import-meta-loader
- Issues: https://github.com/open-wc/open-wc/issues
- npm.io page: https://npm.io/package/@open-wc/webpack-import-meta-loader

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.4.7 (latest) — 2020-05-25
- 0.4.6 — 2020-04-20
- 0.4.5 — 2020-04-12
- 0.4.4 — 2020-03-24
- 0.4.3 — 2020-02-09
- 0.4.2 — 2020-02-02
- 0.4.1 — 2019-11-24
- 0.4.0 — 2019-11-19
- 0.3.4 — 2019-10-25
- 0.3.3 — 2019-10-23
- 0.3.2 — 2019-10-16
- 0.3.1 — 2019-08-05
- 0.3.0 — 2019-07-14
- 0.2.5 — 2019-07-08
- 0.2.4 — 2019-06-05
- … 8 more at https://npm.io/package/@open-wc/webpack-import-meta-loader/versions

## README

# Webpack Helpers

Webpack loader for supporting `import.meta` in webpack.

> Part of [Open Web Components](https://github.com/open-wc/open-wc/): guides, tools and libraries for modern web development and web components

[![CircleCI](https://circleci.com/gh/open-wc/open-wc.svg?style=shield)](https://circleci.com/gh/open-wc/open-wc)
[![BrowserStack Status](https://www.browserstack.com/automate/badge.svg?badge_key=M2UrSFVRang2OWNuZXlWSlhVc3FUVlJtTDkxMnp6eGFDb2pNakl4bGxnbz0tLUE5RjhCU0NUT1ZWa0NuQ3MySFFWWnc9PQ==--86f7fac07cdbd01dd2b26ae84dc6c8ca49e45b50)](https://www.browserstack.com/automate/public-build/M2UrSFVRang2OWNuZXlWSlhVc3FUVlJtTDkxMnp6eGFDb2pNakl4bGxnbz0tLUE5RjhCU0NUT1ZWa0NuQ3MySFFWWnc9PQ==--86f7fac07cdbd01dd2b26ae84dc6c8ca49e45b50)
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com/)

## Note

This is NOT an optimal solution e.g. it may slow down your build a little.
However as currently `import.meta` results in an webpack parse error using a loader is probably the only thing we can do for now.
For details see

- [https://github.com/webpack/webpack/issues/6719](https://github.com/webpack/webpack/issues/6719)
- [https://github.com/Polymer/tools/issues/518](https://github.com/Polymer/tools/issues/518)

If webpack fixed that parse error import.meta will probably work out of the box.
If not then a babel plugin (that can work with AST) will be a better solution.

## Manual Setup

- `yarn add @open-wc/webpack-import-meta-loader`
- Add this to your webpack config

```js
module: {
  rules: [
    {
      test: /\.js$/,
      loader: require.resolve('@open-wc/webpack-import-meta-loader'),
    },
  ],
},
```

---
_Source: https://npm.io/package/@open-wc/webpack-import-meta-loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
