我正在使用Webpack(laravel mix版本)并且使用Isotope会出错。谁能看到我做错了什么?
未找到此依赖项:* ./~/isotope-layout/js/layout-modes/masonry.js
中的砌体/砌体这是我的webpack confix,我试图应用同位素网站上显示的'修复'
const webpack = require('webpack')
const path = require('path')
const config = {
resolve: {
alias: {
'masonry': 'masonry-layout',
'isotope': 'isotope-layout'
}
},
entry: './src/index.js',
output: {
path: path.resolve(__dirname, './dist'),
filename: 'vue-waypoint.js',
library: 'VueWaypoint',
libraryTarget: 'umd'
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.js$/,
include: path.resolve(__dirname, './src'),
exclude: /node_modules/,
use: "babel-loader"
}
]
},
plugins: [
new webpack.optimize.UglifyJsPlugin(),
new webpack.LoaderOptionsPlugin({ minimize: true })
]
}
module.exports = config;
答案 0 :(得分:0)
这很奇怪,看起来你试图在你的代码中重命名npm包masonry-layout
和isotope-layout
,但别名是关于文件夹和路径(https://webpack.js.org/configuration/resolve/#resolve-alias)
你可以简单地使用:
当你require('masonry-layout')
import Istotope from 'masonry-layout'
或npm i masonry-layout --save
或者你可以通过'砌筑布局'作为全球一揽子计划:
new webpack.ProvidePlugin({masonry: 'masonry-layout'})