https://github.com/prantlf/karma-requirejs-esm-preprocessor
Karma preprocessor for converting ES modules to AMD in RequireJS projects.
https://github.com/prantlf/karma-requirejs-esm-preprocessor
amd es6 esm karma karma-plugin karma-preprocessor plugin preprocessor requirejs
Last synced: about 2 months ago
JSON representation
Karma preprocessor for converting ES modules to AMD in RequireJS projects.
- Host: GitHub
- URL: https://github.com/prantlf/karma-requirejs-esm-preprocessor
- Owner: prantlf
- License: mit
- Created: 2022-04-04T22:04:07.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-05-29T18:03:46.000Z (almost 2 years ago)
- Last Synced: 2025-02-01T10:43:00.978Z (4 months ago)
- Topics: amd, es6, esm, karma, karma-plugin, karma-preprocessor, plugin, preprocessor, requirejs
- Language: JavaScript
- Homepage:
- Size: 324 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# karma-requirejs-esm-preprocessor
[

](https://www.npmjs.com/package/karma-requirejs-esm-preprocessor)[Karma] preprocessor for converting ES modules to AMD in [RequireJS] projects. Uses [requirejs-esm-preprocessor].
## Synopsis
```js
module.exports = config => config.set({
preprocessors: {
'src/**/*.js': ['requirejs-esm']
},
requirejsEsmPreprocessor: {
isScript: path => !path.includes('/test/'),
sourceMap: true
}
})
```## Installation
This module can be installed in your project using [NPM], [PNPM] or [Yarn]. Make sure, that you use [Node.js] version 14 or newer.
```sh
npm i -D karma-requirejs-esm-preprocessor
pnpm i -D karma-requirejs-esm-preprocessor
yarn add karma-requirejs-esm-preprocessor
```## Configuration
```ts
isScript(path: string): boolean
```Allows further filtering the files before passing them to the preprocessor. If the patterns are inconvenient to specify what files should be preprocessed, a simple pattern can be used to capture all files and the final filtering be done by `isScript` returning `true` only for the paths to files which need preprocessing. The default is `undefined` - no extra filtering.
```ts
sourceMap: boolean
```Enables an inline source map in the preprocessed output to support debugging in the browser. The default is `true`.
## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Lint and test your code.
## License
Copyright (c) 2022-2023 Ferdinand Prantl
Licensed under the MIT license.
[RequireJS]: http://requirejs.org/
[Karma]: http://karma-runner.github.io/
[requirejs-esm-preprocessor]: https://www.npmjs.com/package/requirejs-esm-preprocessor#readme
[Node.js]: http://nodejs.org/
[NPM]: https://www.npmjs.com/
[PNPM]: https://pnpm.io/
[Yarn]: https://yarnpkg.com/