kentcdodds / kentcdodds/babel-plugin-preval

How to force recompile?

Open
#19 38 comments 8 reactions 0 assignees View on GitHub
docs help wanted
Dominant language
TypeScript
Stars
1.4k
Forks
48
PR merge metrics
No merged PRs in 30d

Description

- `babel-plugin-preval` version: 1.4.1
- `node` version: 8.1.3
- `npm` (or `yarn`) version: npm 5.2.0

Relevant code or config

```javascript
const result = preval`
const fs = require('fs');
const path = require('path');
const content = fs.readFileSync(path.join(__dirname, 'file.md'));
module.exports = content.toString();
`;

console.log(result);
```

What you did: I ran the code above, to export contents of `file.md`.

What happened: when I modify `file.md` the result of `preval` didn't change when I tried to compile it again. Maybe I'm missing something?

Reproduction repository: [demo](https://github.com/silvenon/demo-babel-plugin-preval-recompile/tree/master)

Problem description: `preval` probably doesn't see the reason to recompile because its tagged template literal didn't change.

Suggested solution: I don't know. 😅

Contributor guide

Open the contributing guide

Research direction

Start with the linked demo reproduction and inspect how babel-plugin-preval processes the `preval` tagged template and reads `file.md`. Compare a rebuild after changing `file.md` with the unchanged template, then determine what behavior should trigger recompilation. Done means the generated result reflects updated file contents after recompiling.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.