Skip to content

fix(compiler): allow to specify require when using compileToFunction()#117

Merged
tripodsan merged 1 commit intomasterfrom
fix-module-paths
Feb 3, 2020
Merged

fix(compiler): allow to specify require when using compileToFunction()#117
tripodsan merged 1 commit intomasterfrom
fix-module-paths

Conversation

@tripodsan
Copy link
Copy Markdown
Contributor

@tripodsan tripodsan commented Dec 3, 2019

fixes #114

first workaround for module loading using compileToFunction().

example usage:

const { createRequireFromPath } = require('module');
const path = require('path');
.
.
.
// compile the script to a executable template function
const mods = path.resolve(__dirname, '../modules/index.js');
const template = await compiler.compileToFunction(code, '.', createRequireFromPath(mods));

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 3, 2019

Codecov Report

Merging #117 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #117   +/-   ##
=======================================
  Coverage   83.76%   83.76%           
=======================================
  Files          82       82           
  Lines        3591     3591           
=======================================
  Hits         3008     3008           
  Misses        583      583
Impacted Files Coverage Δ
src/compiler/Compiler.js 98.52% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0fdc085...e5b724e. Read the comment docs.

@tripodsan tripodsan merged commit fb901fd into master Feb 3, 2020
@tripodsan tripodsan deleted the fix-module-paths branch February 3, 2020 02:18
adobe-bot pushed a commit that referenced this pull request Feb 3, 2020
## [3.3.1](v3.3.0...v3.3.1) (2020-02-03)

### Bug Fixes

* **compiler:** allow to specify require when using compileToFunction() ([#117](#117)) ([fb901fd](fb901fd)), closes [#114](#114)
@adobe-bot
Copy link
Copy Markdown

🎉 This PR is included in version 3.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use classes do not allow for paths outside of current folder

2 participants