pugjs / pug-loader

Pug loader module for Webpack
MIT License
425 stars 119 forks source link

Cannot resolve module 'pug-loader' #70

Open cfv1984 opened 7 years ago

cfv1984 commented 7 years ago

Hi! I'm using this for a simple Vue application, with the simplest possible stock webpack settings, and am not able to use pug-loader effectively. I can confirm the dep is there in node_modules, as well as the pug peer dep.

What am I missing?

This is my webpack.config.js (paths altered, but barely)

var webpack = require("webpack");
var path    = require("path");

module.exports = {
    entry: 'path/to/assets/js/src/entry.ts',
    output: {
        path: path.resolve('path/to/assets/js/dist'),
        filename: "app.js"
    },
    resolve: {
        root: ['path/to/assets/js/src','path/to/assets','./node_modules'],
        extensions:['','.js','.pug'],
        alias: {
            "vue$": path.resolve("./node_modules/vue/dist/vue.common.js"),
            "templates": path.resolve("../path/to/templates")
        }
    },
    module: {
        loaders: [
            {test: /\.pug$/, loader: 'pug-loader', query: {root: path.resolve("../path/to/templates")}},
            {test: /\.ts$/, loader: 'ts-loader'}
        ]
    },
    plugins: [
        /* //uncomment to uglify
         new webpack.optimize.UglifyJsPlugin({
         compress: {
         warnings: false,
         dead_code: true,
         conditionals: true,
         comparisons: true,
         evaluate: true,
         booleans: true,
         unused: true,
         loops: true,
         hoist_funs: true,
         cascade: true,
         if_return: true,
         join_vars: true
         },
         mangle: {
         toplevel: true,
         sort: true,
         eval: true,
         properties: true
         },
         sourcemaps: false
         })*///, //uncomment this to do vendoring. See https://www.npmjs.com/package/webpack-split-by-path for docs
        //new SplitByPathPlugin([
        //    { name: 'vendor', path: path.join(__dirname, 'node_modules')},
        //  ], { manifest: 'app-entry'}
        // )
    ]};
RushiBShah commented 1 year ago

do following: npm install pug-loader npm install pug