Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/angular-cli/lib/config/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export interface CliConfig {
apps?: {
root?: string;
outDir?: string;
assets?: string;
publicPath?: string;
assets?: string[];
index?: string;
main?: string;
test?: string;
Expand Down
3 changes: 3 additions & 0 deletions packages/angular-cli/lib/config/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
"type": "string",
"default": "dist/"
},
"publicPath": {
"type": "string"
},
"assets": {
"fixme": true,
"type": "array",
Expand Down
1 change: 1 addition & 0 deletions packages/angular-cli/models/webpack-build-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export function getWebpackCommonConfig(
entry: entry,
output: {
path: path.resolve(projectRoot, appConfig.outDir),
publicPath: appConfig.publicPath,
filename: '[name].bundle.js',
sourceMapFilename: '[name].bundle.map',
chunkFilename: '[id].chunk.js'
Expand Down
31 changes: 31 additions & 0 deletions tests/e2e/tests/third-party/bootstrap_publicPath.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import {npm, ng} from '../../utils/process';
import {updateJsonFile} from '../../utils/project';
import {expectFileToMatch} from '../../utils/fs';
import {oneLineTrim} from 'common-tags';


export default function() {
return Promise.resolve()
.then(() => npm('install', 'bootstrap@next'))
.then(() => updateJsonFile('angular-cli.json', configJson => {
const app = configJson['apps'][0];
app['styles'].push('../node_modules/bootstrap/dist/css/bootstrap.css');
app['scripts'].push(
'../node_modules/jquery/dist/jquery.js',
'../node_modules/tether/dist/js/tether.js',
'../node_modules/bootstrap/dist/js/bootstrap.js'
);
app['publicPath'] = '/publicPathValue/';
}))
.then(() => ng('build'))
.then(() => expectFileToMatch('dist/scripts.bundle.js', '/*!\\n * jQuery JavaScript'))
.then(() => expectFileToMatch('dist/scripts.bundle.js', '/*! tether '))
.then(() => expectFileToMatch('dist/scripts.bundle.js', '/*!\\n * Bootstrap'))
.then(() => expectFileToMatch('dist/styles.bundle.js', '/*!\\n * Bootstrap'))
.then(() => expectFileToMatch('dist/index.html', oneLineTrim`
<script type="text/javascript" src="/publicPathValue/inline.bundle.js"></script>
<script type="text/javascript" src="/publicPathValue/styles.bundle.js"></script>
<script type="text/javascript" src="/publicPathValue/scripts.bundle.js"></script>
<script type="text/javascript" src="/publicPathValue/main.bundle.js"></script>
`));
}