1.1.0 • Published 3 years ago
@handbook/source v1.1.0
@handbook/source
What is this?
You can use this when you need to import a module with its source code together.
For example,
import { source } from '@handbook/source';
const { module: foo, source: fooSource1 } = source(require('./foo'));
const { module: fooImport, source: fooSource2 } = source(() => import('./foo'));
The source()
function will transform the source into the below.
import { source } from '@handbook/source';
const { module: foo, source: fooSource1 } = source({
module: require('./foo'),
source: require('!!raw-loader!./foo'),
filename: 'foo.ts',
});
const { module: fooImport, source: fooSource2 } = source({
module: () => import('./foo'),
source: require('!!raw-loader!./foo'),
filename: 'foo.ts',
});
⚠️ source()
function is just an identifier. You have to set @handbook/babel-plugin
on your babel configuration.
See more
@handbook/*
This package is one of@handbook/*
packages. Go to the project home and see more details.
Related Projects
1.1.0
3 years ago
1.0.0
4 years ago
1.0.0-alpha.6
4 years ago
1.0.0-alpha.5
4 years ago
1.0.0-alpha.4
4 years ago
1.0.0-alpha.3
4 years ago
1.0.0-alpha.2
4 years ago
1.0.0-alpha.1
4 years ago
0.2.4
4 years ago
0.2.2
4 years ago
0.2.1
4 years ago
0.2.0
4 years ago
0.1.0
4 years ago