@zerollup/base-url
TypeScript icon, indicating that this package has built-in type declarations

1.7.4 • Public • Published

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

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @zerollup/base-url

      Weekly Downloads

      5

      Version

      1.7.4

      License

      MIT

      Unpacked Size

      4.18 kB

      Total Files

      9

      Last publish

      Collaborators

      • zerkalica