小编Nbo*_*onD的帖子

设置“rollupOptions.output.file”时选项“output.dir”的值无效

我正在尝试设置我的 vite 构建,以便它输出一个带有预定义名称的 js 文件。这是我的vite.config.js

build: {
    lib: {
      entry: resolve(__dirname, "src/scripts/foo.ts"),
      name: "foo",
      formats: ["es"],
    },
    rollupOptions: {
      output: {
        file: "foo",
        inlineDynamicImports: true,
        format: "es",
      },
    },
  }
Run Code Online (Sandbox Code Playgroud)

此配置会产生错误消息:Invalid value for option "output.dir" - you must set either "output.file" for a single-file build or "output.dir" when generating multiple chunks.

但是如果我设置该rollupOptions.output.dir选项 - 将创建一个 JS 文件(因此不会有多个块)。

我想在我的文件夹中生成一个 js 文件dist,其中包含所有依赖项,并具有预定义的名称。有什么配置可以让我这样做吗?

rollup vite

5
推荐指数
1
解决办法
791
查看次数

没有nttx/effects的HttpHandler提供程序

我正在尝试重新创建一个非常类似于ngrx文档authEffect,并收到此错误消息: Error: StaticInjectorError(AppModule)[HttpClient -> HttpHandler]: StaticInjectorError(Platform: core)[HttpClient -> HttpHandler]: NullInjectorError: No provider for HttpHandler!

效果服务:

@Injectable()
export class HttpEffects {
  constructor(private http: HttpClient, private actions$: Actions) {}

  @Effect() login$: Observable<ActionWithPayload> = this.actions$.pipe(
    ofType(ActionTypes.SEND_LOGIN),
    mergeMap((action: ActionWithPayload) =>
      this.http.post(SERVER_URL + LOGINAPI.LOGIN, action.payload, config).pipe(
        map(data => ({type: 'LOGIN_SUCCESS', payload: data})),
        catchError(() => of({type: 'LOGIN_ERROR'}))
      ))
  );
}
Run Code Online (Sandbox Code Playgroud)

app.module:

@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    StoreModule.forRoot(rootReducer),
    StoreDevtoolsModule.instrument({
      maxAge: 10
    }),
    EffectsModule.forRoot([HttpEffects])
  ],
  exports: [
    BrowserAnimationsModule
  ],
  providers: …
Run Code Online (Sandbox Code Playgroud)

ngrx ngrx-effects angular angular5

2
推荐指数
1
解决办法
1768
查看次数

标签 统计

angular ×1

angular5 ×1

ngrx ×1

ngrx-effects ×1

rollup ×1

vite ×1