我对光滑的滑块和webpack有点问题。 因此,我下载并配置了webpack,然后通过npm slick-carousel下载,但遇到了一些问题。
首先,当我在youtube视频上发现slick无效时,它向我展示了如何配置应该有用的slickfix。 在某种程度上它可以工作,因为它是风格化的,但是问题在于光滑的文件。
$slick-font-path: "/node_modules/slick-carousel/slick/fonts" !default;
$slick-font-family: "slick" !default;
$slick-loader-path: "/node_modules/slick-carousel/slick" !default;
$slick-arrow-color: "black" !default;
const path = require('path');
const HtmlWebPackPlugin = require("html-webpack-plugin");
const webpack = require('webpack');
const $ = require('jquery');
module.exports = {
context: path.resolve(__dirname),
entry: './src',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'main.js'
},
mode: 'development',
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: ['@babel/preset-env']
}
}
},
{
test: /\.html$/,
use: [
{
loader: "html-loader",
options: { minimize: true }
}
]
},
{
test: /\.(png|jpe?g|gif)$/,
use: [
{
loader: 'file-loader',
options: {}
}
]
},
{
test: /\.scss$/,
use: [
'style-loader',
'css-loader',
'sass-loader',
]
},
]
},
plugins: [
new HtmlWebPackPlugin({
template: "./src/index.html",
filename: "./index.html"
}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.$': 'jquery',
'window.jQuery': 'jquery'
})
]
}
浏览器出现错误 https://i.imgur.com/q2F2wUH.jpg