我正在使用Webpack (拉拉混合版本),并得到一个错误的同位素。有人能看出我做错了什么吗?
在./~/isotope-layout/js/layout-modes/masonry.js中找不到这个依赖关系:*中的砖石/砌体
这是我的webpack吐露,我已经尝试了应用“修复”,如同位素现场所示。
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;
发布于 2017-05-03 15:54:09
这很奇怪,看起来您试图在代码中重命名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'})
https://stackoverflow.com/questions/43757134
复制相似问题