Skip to content

Commit

Permalink
feat: improve miniapp
Browse files Browse the repository at this point in the history
  • Loading branch information
天漾 committed Sep 4, 2024
1 parent 61d7c95 commit b4260ec
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/pr_temp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: PR Release

on:
pull_request:

jobs:
release:
name: Release
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16]

steps:
- name: Checkout Branch
uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Setup
run: pnpm run setup

- run: pnpx pkg-pr-new publish './packages/*'
2 changes: 1 addition & 1 deletion packages/ice/templates/core/env.ts.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const isKuaiShouMiniProgram = isClient && import.meta.target === 'kuaisho
export const isWeChatMiniProgram = isClient && import.meta.target === 'wechat-miniprogram';
export const isKraken = isClient && import.meta.target === 'kraken';
export const isQuickApp = false; // Now ice.js will not implement quick app target.
export const isMiniApp = isAliMiniApp || isByteDanceMicroApp || isBaiduSmartProgram || isKuaiShouMiniProgram || isWeChatMiniProgram;
export const isMiniApp = isAliMiniApp;// in universal-env, isMiniApp is equals to isAliMiniApp

// Following variables are runtime executed envs.
// See also @uni/env.
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-miniapp/src/miniapp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const getMiniappTask = ({
enableCache: false,
plugins,
loaders: module?.rules,
assetsManifest: false,
optimization: {
sideEffects: true,
usedExports: true,
Expand Down
12 changes: 11 additions & 1 deletion packages/plugin-miniapp/src/miniapp/webpack/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,23 @@ export class MiniWebpackModule {
test: REG_TEMPLATE,
type: 'asset/resource',
generator: {
filename({ filename }) {
filename: ({ filename }) => {
const extname = path.extname(filename);
return filename.replace(`${this.sourceRoot}/`, '').replace(extname, fileType.templ);
},
},
use: [this.getLoader(path.resolve(__dirname, './loaders/miniTemplateLoader'))],
},
{
test: /\.wxss$/,
type: 'asset/resource',
generator: {
filename: ({ filename }) => {
const extname = path.extname(filename);
return filename.replace(`${this.sourceRoot}/`, '').replace(extname, fileType.style);
},
},
},
];
return { rules };
}
Expand Down

0 comments on commit b4260ec

Please sign in to comment.