https://github.com/krakenjs/webpack-mem-compile
Compile webpack to and from memory
https://github.com/krakenjs/webpack-mem-compile
Last synced: 2 months ago
JSON representation
Compile webpack to and from memory
- Host: GitHub
- URL: https://github.com/krakenjs/webpack-mem-compile
- Owner: krakenjs
- License: apache-2.0
- Archived: true
- Created: 2018-11-10T00:58:47.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2025-01-31T15:55:57.000Z (5 months ago)
- Last Synced: 2025-04-13T01:02:44.281Z (3 months ago)
- Language: TypeScript
- Size: 2.21 MB
- Stars: 3
- Watchers: 11
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
## webpack memory compile
[![build status][build-badge]][build]
[![code coverage][coverage-badge]][coverage]
[![npm version][version-badge]][package]
[![apache license][license-badge]][license][build-badge]: https://img.shields.io/github/actions/workflow/status/krakenjs/webpack-mem-compile/main.yml?branch=main&logo=github&style=flat-square
[build]: https://github.com/krakenjs/webpack-mem-compile/actions?query=workflow%3Abuild
[coverage-badge]: https://img.shields.io/codecov/c/github/krakenjs/webpack-mem-compile.svg?style=flat-square
[coverage]: https://codecov.io/github/krakenjs/webpack-mem-compile/
[version-badge]: https://img.shields.io/npm/v/@krakenjs/webpack-mem-compile.svg?style=flat-square
[package]: https://www.npmjs.com/package/@krakenjs/webpack-mem-compile
[license-badge]: https://img.shields.io/npm/l/@krakenjs/webpack-mem-compile.svg?style=flat-square
[license]: https://github.com/krakenjs/webpack-mem-compile/blob/main/LICENSECompile from a webpack config to a string in memory.
## Install
```bash
npm install --save @krakenjs/webpack-mem-compile
```Note: this package is requires webpack@4 as a peer dependency
## Use
Using a webpack config with an entry point:
```javascript
import { webpackCompile } from '@krakenjs/webpack-mem-compile';const code = await webpackCompile({
webpack,
config: {
entry: 'foo.js';
}
})
```Using raw code:
```javascript
import { webpackCompile } from "@krakenjs/webpack-mem-compile";const code = await webpackCompile({
webpack,
code: `
console.log('Hello World!');
`,
});
```