Aurelia-CLI Webpack issues

Hi

I am going through a aurelia-cli / RequireJS to aureli-cli Webpack.

I am making progress but a couple of issues remaining.

I discovered that webpack need a resolver to find modules so in main I have to do

.plugin(PLATFORM.moduleName("login"))
.plugin(PLATFORM.moduleName("home"))
.plugin(PLATFORM.moduleName("another_module1"))
.plugin(PLATFORM.moduleName("another_module2"))

Is there a easier way to allow all my modules under /src ?

Problem 2.

How do I solve webpack not finding dynamic image paths ie
<img class="nav-icon" src="/src/img/${image_name}"

Thanks

Images was done by adding

new CopyWebpackPlugin([
      { from: 'static/favicon.ico', to: 'favicon.ico' },
      { from: 'src/img/', to: 'img/' },     
    ]),

to webpack.config.js

Is there a easier way to allow all my modules under /src ?

In your webpack.config, replace new AureliaPlugin() with new AureliaPlugin({ includeAll: 'src' })

1 Like

What’s the reasoning to not having this set up as default?

Thanks.
In the end though I continued to use the explicit list in main as using
AureliaPlugin({ includeAll: 'src' }) caused issues with scss files not being found.
ie
<require from="./scss/style.scss"></require> would fail.

I couldn’t find out why it was effected.

I had i folder under src called scss with all the scss files.