Deployment with au-cli

Hello, I m new to Aurelia and webpack.
I made a new project with au-cli. On the local server it s running.
when I run au build --prod env I get a lot of files in the dist folder.
the file extension is .chunk.js Now when I load up the files to the server on the internet nothing works. Not even the hello world example. the console in the browser is complaining that some files could not be loaded and others have the wrong mime type.
i am a Webpack beginner, so maybe someone can help with this problem. my expected output for the build would be
one index.html file and one .js file.
any help greatly appreciated
cheers. mark

1 Like

Hey @funky_guitarist, welcome to the community! :smiley:

I’m by no means a Webpack expert, and calling me a novice may be giving me too much credit , but I thought I’d try to help you figure this out. Can you paste the output: { } bit of the project’s webpack.config.js? I’m wondering if something isn’t funky there for some reason.

Here’s what I’ve currently got in my project, for sake of comparison:

output: {
    path: outDir,
    publicPath: baseUrl,
    filename: production ? '[name].[chunkhash].bundle.js' : '[name].[hash].bundle.js',
    sourceMapFilename: production ? '[name].[chunkhash].bundle.map' : '[name].[hash].bundle.map',
    chunkFilename: production ? '[name].[chunkhash].chunk.js' : '[name].[hash].chunk.js'
  }
1 Like

The dist/ folder contains the final index.html and other resources like js bundles. Those files are the whole app structure, to be deployed to the “root” folder of your production app on server, NOT dist folder on server.

One thing you can try is:

  1. cd to dist folder
  2. boot up a simple web server to just serve static files. For example something like http-server (beware it got problem on win10 right now).
  3. check if the app runs as expected.
1 Like

thank you for your prompt reply

heres my weback.config.js. I can spot no difference.
maybe you?

output: {
path: outDir,
publicPath: baseUrl,
filename: production ? '[name].[chunkhash].bundle.js' : '[name].[hash].bundle.js',
sourceMapFilename: production ? '[name].[chunkhash].bundle.map' : '[name].[hash].bundle.map',
chunkFilename: production ? '[name].[chunkhash].chunk.js' : '[name].[hash].chunk.js'

},

1 Like

hi and thank you for ansering me.
I put the files from the dist folder into the root folder on my server so that can not be the problem.

1 Like

Thought that might be a long shot. Looks good to me.

I just noticed in your original post you state you run au build --prod env. Is this what you are actually executing or was it a typo? The command should be au build --env prod. I tried au build --prod env on a project I’m working on and it does build, though I didn’t test it. I’m guessing the CLI ignores the --prod argument since it’s not recognized. I would still expect it to work, but maybe try au build --env prod and see if that works out.

1 Like