我在我的应用程序中使用Webpack,在其中我创建了我的入口点作为index.ts并且我尝试使用sass css bootstrap typescript作为我的项目webpack中的资源来运行它,但是我遇到了这些错误,(bootstrap) -loader):
错误在./node_modules/bootstrap-loader/no-op.js(./node_modules/bootstrap-loader/lib/bootstrap.scripts.loader.js?{"bootstrapVersion":3,"useCustomIconFontPath":false,"extractStyles “:假的,” styleLoaders “:” 风格装载机 “ ”CSS-装载机“, ”上海社会科学院装载机“], ”风格“: ”混入“, ”正常化“, ”打印“, ”glyphicons“,” s caffolding“,”type“,”code“,”grid“,”tables“,”forms“,”buttons“,”component-animations“,”dropdown“,”button-groups“,”input-groups“, “资产净值”,“导航栏”,“面包屑”,“页码”,“寻呼机”,“标签”,“徽章”,“超大屏幕”,“缩略图”,“警告”,“进步酒吧”,“媒体”, “列表基”, “板”, “孔”, “响应-嵌入”, “接近”, “模态”, “提示”, “popovers”, “转盘”, “实用程序”, “响应公用事业”] , “脚本”: “转型”, “警告”, “按钮”, “旋转木马”, “崩溃”, “下拉列表”, “莫代尔”, “提示”, “酥料饼”, “scrollspy”, “标签”, “加盖”], “configFilePath”: “/项目/ bootstrapwebpack / node_modules /引导装载程序/ .bootstraprc -3-默认”, “bootstrapPath”: “/项目/ bootstrapwebpack / node_modules /自举-萨斯”,“bootst rapRelPath“:”../ bootstrap-sass“}! . / node_modules / bootstrap-loader / no-op.js)...
In my config.js I have :
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: [ 'bootstrap-loader', './src/index.ts',],
module: {
rules:[
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
],
},
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['env']
}
}
},
{
test: /\.(gif|png|jpe?g|svg)$/i,
use: [
'file-loader',
{
loader: 'image-webpack-loader',
options: {
},
},
],
},
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
exclude: /node_modules/
},
// Boooootstrap
{
test: /bootstrap-sass\/assets\/javascripts\//,
loader: 'imports-loader?jQuery=jquery'
},
{
test: /\.(woff2?|svg)$/, loader: 'url-loader?limit=10000'
},
{
test: /\.(ttf|eot)$/, loader: 'file-loader'
},
],
},
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'dist')
}
};
Currently I'm trying to use in my package.json these following lines :
{
"name": "test",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"dev": "webpack --mode development --watch ",
"build": "webpack --progress -p --watch "
},
"dependencies": {
"autoprefixer": "^9.0.0",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-preset-env": "^1.7.0",
"bootstrap": "^4.1.2",
"bootstrap-loader": "^3.0.0",
"bootstrap-sass": "^3.3.7",
"css-loader": "^1.0.0",
"exports-loader": "^0.7.0",
"file-loader": "^1.1.11",
"image-webpack-loader": "^4.3.1",
"jquery": "^3.3.1",
"mini-css-extract-plugin": "^0.4.1",
"node-sass": "^4.9.2",
"popper.js": "^1.14.3",
"postcss-loader": "^2.1.6",
"resolve-url-loader": "^2.3.0",
"sass-loader": "^7.0.3",
"style-loader": "^0.21.0",
"ts-loader": "^4.4.2",
"typescript": "^2.9.2",
"url-loader": "^1.0.1",
"webpack": "^4.16.0",
"webpack-cli": "^3.0.8"
}
}
1 回答
我昨天遇到了同样的问题 . 尝试添加
./src/index.ts