Ich möchte das .js-Suffix von Angular-Importen entfernen.So entfernen Sie das .js-Suffix von Angular-Importen
Nicht (jetzt bearbeitbar) gesucht:import { Example } from './whatever/example.js';
gesuchtimport { Example } from './whatever/example';
Ich vermute, ich in der systemjs.config.js
eine Konfiguration am fehlt.
(function (global) {
System.config({
paths: {
// paths serve as alias
'npm:': '/node_modules/'
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder
'app': 'app',
// angular bundles
// other libraries
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
defaultExtension: 'js'
},
rxjs: {
defaultExtension: 'js'
}
}
});
})(this);
haben Sie versucht, 'defaultJSExtensions mit: true' in Ihrem' system.config (. .. "? – Wernerson
@Wernerson Ja, es funktioniert nicht. Zone.js: 2224 GET http: // localhost: 8000/app/was auch immer/Beispiel 404 (nicht gefunden) – Olezt