Skip to content

Latest commit

 

History

History

base-url

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

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