Gathering detailed insights and metrics for babel-plugin-inline-import
Gathering detailed insights and metrics for babel-plugin-inline-import
Gathering detailed insights and metrics for babel-plugin-inline-import
Gathering detailed insights and metrics for babel-plugin-inline-import
babel-plugin-inline-import-data-uri
Babel plugin to make raw files importable as base64 encoded data URI strings.
babel-plugin-import-graphql
Babel plugin to make .gql/.graphql files importable
babel-plugin-inline-json-import
Inlines JSON file imports straight into JS code
@startupjs/babel-plugin-rn-stylename-inline
Use styleName attributes with inline css and styl template strings
npm install babel-plugin-inline-import
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
244 Stars
144 Commits
29 Forks
4 Watchers
10 Branches
13 Contributors
Updated on Jul 07, 2025
Latest Version
3.0.0
Package Id
babel-plugin-inline-import@3.0.0
Size
4.62 kB
NPM Version
6.1.0
Node Version
8.9.1
Published on
Jun 05, 2018
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
Babel plugin to add the opportunity to use import
with raw/literal content
It is good e.g. for importing *.graphql
files into your code.
Before (without Babel-Inline-Import):
1// server.js 2 3// bad syntax highlighting, no syntax checking 4const typeDefinitions = ` 5type Query { 6 testString: String 7} 8schema { 9 query: Query 10} 11`; 12 13graphQLServer({ 14 schema: [typeDefinitions], 15 ... 16});
Now (with Babel-Inline-Import):
1// /some/schema.graphql 2type Query { 3 testString: String 4} 5schema { 6 query: Query 7}
1// server.js 2import schema from '/some/schema.graphql'; 3 4graphQLServer({ 5 schema: [schema], 6 ... 7});
Note: both cases are equivalent and will result in similar code after Babel transpile them. Check How it works section for details.
npm install babel-plugin-inline-import --save-dev
Add a .babelrc
file and write:
1{ 2 "plugins": [ 3 "babel-plugin-inline-import" 4 ] 5}
or pass the plugin with the plugins-flag on CLI
babel-node myfile.js --plugins babel-plugin-inline-import
By default, Babel-Inline-Import is compatible with the following file extensions:
If you want to enable different file extensions, you can define them in your .babelrc
file
1{ 2 "plugins": [ 3 ["babel-plugin-inline-import", { 4 "extensions": [ 5 ".json", 6 ".sql" 7 ] 8 }] 9 ] 10}
It inserts the content of the imported file directly into the importing file, assigning it to a variable with the same identifier of the import statement, thus replacing the import statement and the file path by its resulting raw content (no parsing occurs).
Babel does not track dependency between imported and importing files after the transformation is made. Therefore, you need to change the importing file in order to see your changes in the imported file spread. To overcome this:
babel-node
or babel-register
, you can disable babel cache (BABEL_DISABLE_CACHE=1
).babel-loader
, you can use babel-inline-import-loader.Also make sure that your task runner is watching for changes in the imported file as well. You can see it working here.
If you like this project just give it a star :) I like stars.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 6/22 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
38 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More