-
Notifications
You must be signed in to change notification settings - Fork 12k
Chunks are not getting generated with @ngtools/webpack #8563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
pls post tsconfig.webpack.json |
{ Do i need to use @angularclass/hmr-loader, ng-router-loader, angular2-template-loader while using Thanks in advance |
tsconfig looks good. Maybe you have wrong defined routers. |
Actually having the same problem here... webpack: var webpack = require("webpack");
var path = require("path");
var clone = require("js.clone");
var merge = require("webpack-merge");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var ContextReplacementPlugin = require("webpack/lib/ContextReplacementPlugin");
var TsConfigPathsPlugin = require("awesome-typescript-loader").TsConfigPathsPlugin;
var CheckerPlugin = require("awesome-typescript-loader").CheckerPlugin;
var DefinePlugin = require("webpack/lib/DefinePlugin");
var CopyWebpackPlugin = require("copy-webpack-plugin");
var isDevBuild = process.env.ASPNETCORE_ENVIRONMENT === "Production" ? false : true;
var isAotBuild = false;
var AngularCompilerPlugin = require('@ngtools/webpack').AngularCompilerPlugin;
module.exports = (env) => {
if (env && env.prod)
isDevBuild = false;
if (env && env.aot) {
isAotBuild = true;
}
var distDirectory = "./wwwroot/dist";
var defaultLoaders = ["awesome-typescript-loader?silent=true", "angular2-template-loader", "angular-router-loader"];
var sharedConfig = {
resolve: {
extensions: [".js", ".ts", ".css", ".scss", ".json"]
},
stats: { modules: false },
context: __dirname,
output: {
filename: "[name].js",
publicPath: "/dist/"
},
module: {
loaders: [
{ test: /\.ts$/, use: isDevBuild ? defaultLoaders : isAotBuild ? '@ngtools/webpack' : defaultLoaders },
{ test: /\.html$/, use: "raw-loader" },
{ test: /\.css/, use: "raw-loader" },
{ test: /\.scss$/, use: ["raw-loader", "sass-loader"] },
{ test: /initial\.scss$/, use: ExtractTextPlugin.extract({ fallback: "style-loader", use: "css-loader!sass-loader?sourceMap" }) },
{ test: /\.json$/, use: "json-loader" },
{ test: /\.woff(2)?(\?v=.+)?$/, use: "url-loader?limit=10000&mimetype=application/font-woff&name=fonts/[name].[ext]" },
{ test: /\.(ttf|eot|svg)(\?v=.+)?$/, use: "file-loader?&name=fonts/[name].[ext]" },
{ test: /bootstrap\/dist\/js\/umd\//, use: "imports?jQuery=jquery" },
{ test: /\.(png|jpg|gif)$/, use: "file-loader?limit=8192&name=assets/img/[name].[ext]" }
]
},
plugins: [ new CheckerPlugin() ]
};
var clientConfig = setTypeScriptAlias(require("./tsconfig.json"), {
entry: {
'main-client': "./Client/bootstrap-client.ts"
},
output: {
path: path.join(__dirname, distDirectory),
filename: "[name].js",
publicPath: "/dist/"
},
plugins: [
new DefinePlugin({ 'process.env': { 'development': true } }),
new ContextReplacementPlugin(
// The (\\|\/) piece accounts for path separators in *nix and Windows
/angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
root("./Client")
),
new TsConfigPathsPlugin({ tsconfig: "tsconfig.json" }),
new webpack.DllReferencePlugin({
context: __dirname,
manifest: require("./wwwroot/dist/vendor-manifest.json")
})
].concat(isDevBuild ?
[
new webpack.SourceMapDevToolPlugin({ filename: "[file].map", moduleFilenameTemplate: path.relative(distDirectory, "[resourcePath]") })
] :
[
new webpack.optimize.UglifyJsPlugin()
]
).concat(isAotBuild ?
[
new AngularCompilerPlugin({
tsConfigPath: './tsconfig.json',
entryModule: path.join(__dirname, 'Client/app/platform-modules/app.browser.module#AppBrowserModule'),
exclude: ['./**/*.server.ts']
})
] :
[])
});
// Merge with Shared
var mergedClientConfig = merge(sharedConfig, clientConfig);
return [mergedClientConfig];
};
function setTypeScriptAlias(tsConfig, config) {
var newConfig = clone(config);
newConfig = newConfig || {};
newConfig.resolve = newConfig.resolve || {};
newConfig.resolve.alias = newConfig.resolve.alias || {};
var tsPaths = tsConfig.compilerOptions.paths;
for (var prop in tsPaths) {
newConfig.resolve.alias[prop] = root(tsPaths[prop][0]);
}
return newConfig;
}
function root(args) {
args = Array.prototype.slice.call(arguments, 0);
return path.join.apply(path, [__dirname].concat(args));
} scripts i use to compile:
As you can see it's not generating the chunks in AOT mode. |
There was a similar issue (#8597) where the problem was |
Actually i was following the thread you linked aswell.
I'm not really sure about what it does... i just took it from another template a couple months ago, but that was my deal-breaker. |
Hey @EmaGht have you resolved this issue, if Yes then can you please let us know the solutions. |
@sjumble I just excluded the DllReference plugin from the plugin chain during aot build, you can see my webpack configuration in my rant about the current state of node's package manager here: yarnpkg/yarn#2088 |
Closing as no re-production was provided. If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Versions
Webpack.common.js
module: {
rules: [{
loader: '@ngtools/webpack',
options: {
configFileName: 'tsconfig.webpack.json',
}
}],
plugins: [{
new AngularCompilerPlugin({
"sourceMap": true,
"tsConfigPath": helpers.root('tsconfig.webpack.json'),
"skipCodeGeneration": true,
"compilerOptions": {}
}),
}]
}
Actual result: Chunks is not getting generated for lazy loaded modules
Expected Result: Should generate chunks
The text was updated successfully, but these errors were encountered: