Skip to content

ERROR in Error: Child compilation failed: Module build failed: Error: The path for file doesn't contain relativeTo param #73

Description

@karthikdeva

I'm new into webpack and trying move gulp to webpack. facing issue in "ngtemplate-loader". Below is my webpack config.

const path = require('path');
const webpack = require("webpack");
const optimize = webpack.optimize;
const htmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const config = require('./webpack/config');

var webpackConfig = {

entry: {
    vendor: vendorResources,
    app: ["./src/app/index.module.ts"]     
},
output: {
    path: path.resolve(__dirname, "dist"),
    filename: "scripts/[name].js",
},
devtool: "source-map",
module: {
    rules: [{
            test: /\.html$/,
            use: [
                { loader: 'ngtemplate-loader?relativeTo=' + (path.resolve(__dirname, './src/app')) },
                { loader: 'html-loader' }
            ]
        },
        {
            test: /\.ts?$/,
            use: [{
                loader: 'awesome-typescript-loader'
            }, {
                loader: 'tslint-loader'
            }],
            exclude: /node_modules/
        }
    ],
},
resolve: {
    extensions: [".ts", ".tsx", ".js", ".json", ".jsx", ".css", ".scss", ".sass"]
},
externals: {},
plugins: [
    new ExtractTextPlugin({
        filename: (getPath) => {
            return getPath('styles/[name].css').replace('js', 'css');
        },
        allChunks: false
    }),
   
]

}
module.exports = webpackConfig;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions