@flatjs/sculpt
v2.1.6
Published
## Usages
Downloads
271
Readme
@flatjs/sculpt
Usages
The configuration file flatjs-sculpt.config.ts
;
import { defineConfig } from '@flatjs/sculpt';
export default defineConfig({
input: [
'src/app.ts',
'src/components/*/index.ts',
'src/modules/home/pages/page1/index.ts',
'src/modules/home/pages/page2/index.ts',
'src/modules/mine/pages/page1/index.ts',
'src/modules/mine/pages/page2/index.ts',
],
modularImports: [
{
libraryDirectory: 'cjs',
libraryName: '@dimjs/utils',
},
],
devServer: {
autoOpen: false,
},
});
The advanced example
export default defineConfig({
input: ['src/app.ts', 'src/components/*/index.ts'],
projectVirtualPath: 'sculpt/demo',
devServer: {
mockOptions: {
mockBaseDir: `./mocks`,
apiContext: '/api',
hostname: 'dev.flatjs.com',
port: 4000,
staticMap: {
'/static': 'static',
},
mockMap: {
'/account': { type: 'REST', defs: ['account'], middlewares: {} },
},
},
},
plugin: {
pluginConfigs: {
terserOptions: {
compress: {
// drop_console: true,
pure_funcs: [
'console.log',
'console.info',
'console.debug',
'console.warn',
],
},
},
},
},
assetsCopyPattern: ['src/native/*.png'],
assetsOptions: {
inlineFallbackType: [
'public',
{
virtualPath: 'sculpt/demo',
distFolder: 'public',
cdnUrls: ['https://cdn.example.com'],
},
],
},
modularImports: [
{
libraryDirectory: 'cjs',
libraryName: '@wines/core',
},
{
libraryDirectory: 'cjs',
libraryName: '@wines/request',
},
{
libraryDirectory: 'cjs',
libraryName: '@dimjs/utils',
},
{
libraryDirectory: 'cjs',
libraryName: '@dimjs/lang',
},
{
libraryDirectory: 'cjs',
libraryName: '@dimjs/secure',
},
],
});
API 环境变量
export const appApi: ServiceConfig = {
me: process.env.MOCK_SCULPT_BASE || '',
inte: `http://dev.venus.org/api`,
rc: `https://qa.example.top/api`,
prod: 'https://example.top/api',
};
分包
// app.json
// 注意此处是 `subpackages`而不是`subPackages`
"subpackages": [
{
"root": "subpackages-basic",
"name": "subpackages-basic",
"pages": [
"pages/tools/index",
"pages/login/index",
"pages/offline/index",
"pages/webview/index"
]
},
{
"root": "subpackages-other",
"name": "subpackages-other",
"pages": ["pages/protocol/index"]
}
],