Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Webpack
raw-loader
implemented asbabel-plugin-macros
In order to use raw.macro in your own project, you can use one of the following commands:
$ yarn add --dev raw.macro
# or
$ npm install --save-dev raw.macro
Make sure babel-plugin-macros
already installed. If you're using Create React App, it's installed by default.
raw.macro is similar to Node’s require
call:
import raw from "raw.macro";
const markdown = raw("./README.md");
Note: Because raw.macro uses babel internally to replace raw()
calls, your transpiled code won't be changed if you only change the file that you import. This is because from babel perspective, your JS file is unchanged
One workaround that you can do that doesn't involve restarting your build system is making small changes where you put raw()
calls, for example by adding console.log()
with different content.
You can also use import dynamic path using template literal. You can even use them inside a function / React component!
import raw from "raw.macro";
function Article(props) {
const content = raw(`../content/${props.locale}.md`);
return <Markdown content={content} />;
}
This method has 2 caveats:
MIT
FAQs
Read file contents at build time, similar to webpack raw-loader
The npm package raw.macro receives a total of 2,988 weekly downloads. As such, raw.macro popularity was classified as popular.
We found that raw.macro demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.