Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork30
Import modules from URL instead of local node_modules
License
egoist/import-http
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Please considerdonating to this project's author,EGOIST, to show your ❤️ and support.
Imports source code URLs! Like
<script type="module">andDeno but implemented as a webpack/Rollup plugin. Embracing the future :)importtemplatefrom'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 untilyou use the
reloadoption. See more aboutCaching.No more
node_modulesbloat, no dependency to install.
yarn add import-http --dev
In yourwebpack.config.js:
constImportHttpWebpackPlugin=require('import-http/webpack')module.exports={plugins:[newImportHttpWebpackPlugin()]}
That's it, try following code:
importReactfrom'https://unpkg.com/react'importVuefrom'https://unpkg.com/vue'console.log(React,Vue)
Run webpack and it just works.
In yourrollup.config.js:
exportdefault{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 thereload option to invalidate cache:
constImportHttpWebpackPlugin=require('import-http/webpack')module.exports={plugins:[newImportHttpWebpackPlugin({reload:process.env.RELOAD})]}
Then runRELOAD=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 theMIT License.
Authored and maintained by EGOIST with help from contributors (list).
Website · GitHub@EGOIST · Twitter@_egoistlily
About
Import modules from URL instead of local node_modules
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.
