Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

architect-examples/arc-proxy-plugin-bare-imports

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚠️ This repository has been archived. Use @proxy or asap for proxying in Architect. This plugin is not compatible with the plugins API for Architect. For an updated list other examples refer to arc.codes/examples.

@architect/proxy-plugin-bare-imports

Loosely based on the nascent import maps proposal for bringing bare imports to the browser this plugin allows arc.proxy.public assets have bare imports that resolve to web standards browser native esmodules URLs.

Install

cd src/http/get-index
npm i @architect/proxy-plugin-bare-imports

Usage

Add the plugin to process the filetypes you're interested in (in this case .mjs files) and then add an imports section to the config to map bare values to URLs:

// src/http/get-index/index.js
let arc = require('@architect/functions')

exports.handler = arc.proxy.public({
  plugins: {
    mjs: ['@architect/proxy-plugin-bare-imports']
  },
  imports: {
    'foo': '/vendor/foo.mjs',
    'preact': 'https://cdn.jsdelivr.net/npm/preact/dist/preact.mjs'
  }
})

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •