Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@zerollup/base-url

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zerollup/base-url

Configure assets base url in runtime

latest
Source
npmnpm
Version
1.7.4
Version published
Maintainers
1
Created
Source

Assets base url

Configure assets base url in runtime. Modularized webpack_public_path analog.

How to configure:

./my-module-name/src/bootstrap.ts

import bu from '@zerollup/base-url'

bu.assets = 'https://my-statics.com/assets/'

./my-module-name/src/index.ts

import './bootstrap'
import svg from './my-pic.svg'
console.log(svg)

Rollup rollup-plugin-assets transpile it into

./my-module-name/src/index.js

bu.assets = 'https://my-statics.com/assets/'

console.log(bu.assets + 'my-module-name/my-pic.svg')

First set baseUrl.assets value, place setup code to separate bootstrap file and import it first in index.js.

Example zerollup demo site bundle.

For typescript

Install typescript asset module resolver fix:

cp -rf ./node_modules/@zerollup/base-url/@types/assets-fix ./node_modules/@types

Keywords

configuration

FAQs

Package last updated on 07 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts