2.0.7 • Published 1 year ago

babel-plugin-transform-file-imports-to-string v2.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

babel-plugin-transform-file-imports-to-string

  • import any type of files to string in any environment running babel browser / node / react-native

Installation

npm i -D babel-plugin-transform-file-imports-to-string
yarn add -D babel-plugin-transform-file-imports-to-string

Usage

Via .babelrc or babel.config.js (Recommended)

.babelrc

{
  "plugins": ["transform-file-imports-to-string"]
}

Via CLI

$ babel --plugins transform-file-imports-to-string script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-file-imports-to-string"]
});

Usage Examples

  • import html files
<h1>Hello</h1>

Import

import html from '!!file-loader!./example.html';
  • import js files as string
const str = 'Hello, World !!';
console.log(str);

Import

import html from '!!file-loader!./example.js';
2.0.7

1 year ago

2.0.6

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago