Please consider donating to this project's author, EGOIST, to show your ❤️ and support.
- 
Imports source code URLs! Like <script type="module">and Deno but implemented as a webpack/Rollup plugin. Embracing the future :)import template from 'https://unpkg.com/lodash-es/template' console.log(template(`Hello <%= name %>`)({ name: 'EGOIST' })) Remote code is fetched and cached on first build, and never updated until you use the reloadoption. See more about Caching.
- 
No more node_modulesbloat, no dependency to install.
yarn add import-http --devIn your webpack.config.js:
const ImportHttpWebpackPlugin = require('import-http/webpack')
module.exports = {
  plugins: [new ImportHttpWebpackPlugin()]
}That's it, try following code:
import React from 'https://unpkg.com/react'
import Vue from 'https://unpkg.com/vue'
console.log(React, Vue)Run webpack and it just works.
In your rollup.config.js:
export default {
  plugins: [require('import-http/rollup')()]
}Resources will be fetched at the very first build, then the response will be cached in ~/.cache/import-http dir. You can use the reload option to invalidate cache:
const ImportHttpWebpackPlugin = require('import-http/webpack')
module.exports = {
  plugins: [
    new ImportHttpWebpackPlugin({
      reload: process.env.RELOAD
    })
  ]
}Then run RELOAD=true webpack to update cache.
- Fork it!
- Create your feature branch: git checkout -b my-new-feature
- Commit your changes: git commit -am 'Add some feature'
- Push to the branch: git push origin my-new-feature
- Submit a pull request :D
import-http © EGOIST, Released under the MIT License.
Authored and maintained by EGOIST with help from contributors (list).
Website · GitHub @EGOIST · Twitter @_egoistlily
