This repository was archived by the owner on Oct 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 70
Module build failed errorΒ #89
Copy link
Copy link
Open
Description
I'm trying to use this loader but I get an error.
Uncaught Error: Module build failed (from ./node_modules/typings-for-css-modules-loader/lib/index.js):
Error: Cannot find module 'css-loader/locals'
at Function.Module._resolveFilename (:9000/internal/modules/cjs/loader.js:611)
at Function.Module._load (:9000/internal/modules/cjs/loader.js:537)
at Module.require (:9000/internal/modules/cjs/loader.js:665)
at require (:9000/internal/modules/cjs/helpers.js:20)
at Object.<anonymous> (:9000/Users/Vega/projects/frontend-environment/client/node_modules/typings-for-css-modules-loader/lib/index.js:9)
at Module._compile (:9000/internal/modules/cjs/loader.js:736)
at Object.Module._extensions..js (:9000/internal/modules/cjs/loader.js:747)
at Module.load (:9000/internal/modules/cjs/loader.js:628)
at tryModuleLoad (:9000/internal/modules/cjs/loader.js:568)
at Function.Module._load (:9000/internal/modules/cjs/loader.js:560)
at Object../node_modules/typings-for-css-modules-loader/lib/index.js?!./src/css/index.css (bootstrap:151)
at __webpack_require__ (bootstrap:78)
at Object../src/css/index.css (index.css:2)
at __webpack_require__ (bootstrap:78)
at Module../src/index.ts (index.ts:1)
at __webpack_require__ (bootstrap:78)
at Object.0 (module1.ts:11)
at __webpack_require__ (bootstrap:78)
at checkDeferredModules (bootstrap:45)
at bootstrap:151
My webpack config:
var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
let distPath = path.resolve(__dirname, 'dist');
module.exports = {
entry: './src/index.ts',
output: {
path: distPath,
chunkFilename: '[name]-[contenthash].chunk.js',
filename: '[name]-[contenthash].js'
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.js$/,
loader: 'babel-loader',
query: {
presets: ['@babel/env']
},
exclude: [/node_modules/]
}
, {
test: /\.(html)$/,
use: [{
loader: 'html-loader',
options: {
attrs: false
}
}]
}
, {
test: /\.(jpg|jpeg|png|gif)$/,
use: [{
loader: 'url-loader',
options: {
limit: 1,
name: `img/[name]-[hash].[ext]`
}
}]
}, {
test: /\.css$/,
use: [
{
loader: "style-loader"
}, {
loader: 'typings-for-css-modules-loader',
options: {
modules: true,
namedExport: true,
camelCase: true
}
}
]
}
]
},
resolve: {
extensions: [ '.tsx', '.ts', '.js', ',css', '*' ]
},
stats: {
colors: true
},
devtool: 'inline-source-map',
devServer: {
host: '0.0.0.0',
port: 9000,
open: true
},
plugins: [
new HtmlWebpackPlugin({
template: './index.html'
}),
new CleanWebpackPlugin(['dist'])
],
optimization: {
usedExports: true,
splitChunks: {
chunks: 'all',
minSize: 1,
name: true
}
}
};
What do I do wrong?
mgol, thepedroferrari, alexandrklimov, ccpu, petekp and 8 morenoahzgard, lski, Falieson, jens-duttke, thepedroferrari and 3 more
Metadata
Metadata
Assignees
Labels
No labels