Aurelia 2 aurelia/store-v1: Field 'browser' doesn't contain a valid alias configuration

I am trying to add aurelia store to an Aurelia 2 project. With the following configuration (from Configuration and Setup - The Aurelia 2 Docs):

import { I18nConfiguration } from '@aurelia/i18n';
import { RouterConfiguration } from '@aurelia/router';
import { StoreConfiguration } from '@aurelia/store-v1';
import Aurelia from 'aurelia';
import Fetch from 'i18next-fetch-backend';
import { initialState } from './infra/store/state';
import { MyApp } from './my-app';

Aurelia.register(
    RouterConfiguration.customize({
        useUrlFragmentHash: false
    })
)
    .register(
        I18nConfiguration.customize((options) => {
            options.initOptions = {
                plugins: [Fetch],
                backend: {
                    loadPath: '/locales/{{lng}}/{{ns}}.json'
                },
                lng: 'nl',
                fallbackLng: 'en',
                debug: false
            };
        })
    )
    .register(StoreConfiguration.withInitialState(initialState))
    .app(MyApp)
    .start();

I am getting the following error:

ERROR in ./node_modules/@aurelia/store-v1/dist/esm/index.mjs 7:0-66
Module not found: Error: Can't resolve 'rxjs/operators' in '/Users/the-directory-to-the-aurelia-project-root/node_modules/@aurelia/store-v1/dist/esm'
Did you mean 'index.js'?
BREAKING CHANGE: The request 'rxjs/operators' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
resolve 'rxjs/operators' in '/Users/the-directory-to-the-aurelia-project-root/node_modules/@aurelia/store-v1/dist/esm'
  Parsed request is a module
  using description file: /Users/the-directory-to-the-aurelia-project-root/node_modules/@aurelia/store-v1/package.json (relative path: ./dist/esm)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      looking for modules in /Users/the-directory-to-the-aurelia-project-root/src
        /Users/the-directory-to-the-aurelia-project-root/src/rxjs doesn't exist
      looking for modules in /Users/the-directory-to-the-aurelia-project-root/dev-app
        /Users/the-directory-to-the-aurelia-project-root/dev-app/rxjs doesn't exist
      /Users/the-directory-to-the-aurelia-project-root/node_modules/@aurelia/store-v1/dist/esm/node_modules doesn't exist or is not a directory
      /Users/the-directory-to-the-aurelia-project-root/node_modules/@aurelia/store-v1/dist/node_modules doesn't exist or is not a directory
      /Users/the-directory-to-the-aurelia-project-root/node_modules/@aurelia/store-v1/node_modules doesn't exist or is not a directory
      /Users/the-directory-to-the-aurelia-project-root/node_modules/@aurelia/node_modules doesn't exist or is not a directory
      /Users/the-directory-to-the-aurelia-project-root/node_modules/node_modules doesn't exist or is not a directory
      looking for modules in /Users/the-directory-to-the-aurelia-project-root/node_modules
        existing directory /Users/the-directory-to-the-aurelia-project-root/node_modules/rxjs
          using description file: /Users/the-directory-to-the-aurelia-project-root/node_modules/rxjs/package.json (relative path: .)
            using description file: /Users/the-directory-to-the-aurelia-project-root/node_modules/rxjs/package.json (relative path: ./operators)
              Field 'browser' doesn't contain a valid alias configuration
              /Users/the-directory-to-the-aurelia-project-root/node_modules/rxjs/operators is not a file
      /Users/my-user/Workplace/Repositories/folder/node_modules doesn't exist or is not a directory
      /Users/my-user/Workplace/Repositories/node_modules doesn't exist or is not a directory
      /Users/my-user/Workplace/node_modules doesn't exist or is not a directory
      /Users/my-user/node_modules doesn't exist or is not a directory
      /Users/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
 @ ./src/main.ts 3:0-55 22:14-49

webpack 5.75.0 compiled with 1 error in 4802 ms

Am I doing something wrong?

What bundler are you using in your application?

Thanks for the response! I am using webpack.

Let me see if I can reproduce this and get a solution for you.

1 Like

@dwaynecharrington Any luck with the reproduction? Or can I assist with anything?