tomtomau / aurelia-mousetrap

An Aurelia plugin that bridges keyboard shortcuts via Mousetrap.js and autowires EventAggregator
Creative Commons Zero v1.0 Universal
11 stars 1 forks source link

Update to Support Aurelia-Webpack Plugin #2

Open justindra opened 5 years ago

justindra commented 5 years ago

Need to use the proper dependency stuff so webpack can import with no issues

https://github.com/aurelia/webpack-plugin/wiki/Managing-dependencies

ivanbacher commented 4 years ago

Did you manage to get it to work with webpack? I am getting the following error:

aurelia.use.plugin( PLATFORM.moduleName('aurelia-mousetrap'), config => {
    // Example keymap
    config.set('keymap', {
      "/": "KS_SEARCH"
    });
  })
./node_modules/aurelia-mousetrap/dist/commonjs/mousetrap-config.js
Module not found: Error: Can't resolve 'mousetrap' in '/Users/ivan/Workspace/DLAB/2019_huawei_adverts_2_UI/node_modules/aurelia-mousetrap/dist/commonjs'
justindra commented 4 years ago

@ivanbacher I added this as well in my webpack.config.js

...
  plugins: [
    new AureliaPlugin(),
    new ModuleDependenciesPlugin({
      'aurelia-mousetrap': ['./mousetrap-click', './mousetrap-focus', './mousetrap-blur']
    }),
  ],
...

See if that works for you.

ivanbacher commented 4 years ago

Great. Thanks for the help. I ended up just imported mousetrap the standard way.