aurelia / aurelia/cli

Aurelia CLI run webpack task assumes `config.entry.app` exists

Open
#1,144 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
402
Forks
134
PR merge metrics
No merged PRs in 30d

Description

**I'm submitting a bug report**

* **Library Version:**
Aurelia CLI 1.0.2

**Please tell us about your environment:**
* **Operating System:**
OSX 10.14|

* **Node Version:**
8.9..0

* **NPM Version:**
5.5.1

* **Browser:**
all

* **Language:**
all
* **Loader/bundler:**
Webpack

**Current behavior:**
I want to change the name of the entry point in webpack.config.js from
```
entry: {
app: ['aurelia-bootstrapper']
}
```
to
```
entry: {
'admin-app': ['aurelia-bootstrapper']
}
```
This is so that in output I'm able to redefine what `[name]` is:
```
output: {
path: outDir,
publicPath: baseUrl,
filename: '[name].bundle.js',
sourceMapFilename: '[name].bundle.map',
chunkFilename: '[name].bundle.js',
},
```
This works, such that I'd get `admin-app.bundle.js`, however, when I do "au run", I get an error: `TypeError: Cannot read property 'unshift' of undefined`
This appears to be related to `aurelia_project/tasks/run.ts` assuming the entry point is found at `config.entry.app` (line 32 and 35). However, by specifying it as 'admin-app' in webpack.config.js, there is no such property "app" in `config.entry`.

* **What is the expected behavior?**

I should be able to rename the entrypoint to `admin-app` such that the scripts reflect that name, and "au run" should work without errors. Ideally there should be a way to specify the name/entry point in `aurelia_project/aurelia.json`

* **What is the motivation / use case for changing the behavior?**
I would like to namespace my scripts in an easy, convenient way, since I maintain multiple aurelia projects and serve the scripts from a CDN. Not all of my projects can reference the same `app.bundle.js` file.

Contributor guide

Open the contributing guide

Research direction

Start in aurelia_project/tasks/run.ts at the reported lines 32 and 35, then compare those assumptions with the renamed entry in webpack.config.js. Reproduce the failure with `admin-app` replacing `app`; done means `au run` completes without the undefined `unshift` error and produces scripts using the renamed entry point.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript, webpack
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.