fe-star / exercise12 Goto Github PK
View Code? Open in Web Editor NEW练习12: 写一个loader
练习12: 写一个loader
module.exports = {
entry: './src/index.js',
output: {
path: path.join(__dirname, 'dist'),
filename: 'index.js'
},
module: {
rules: [
{
test: /\.js/,
use: [
'define-loader'
]
}
]
},
resolveLoader: {
modules: [
'node_modules',
path.resolve(__dirname, 'loader')
]
}
}
我理一下顺序~还有点提问;
理解 : entry入口进来后~进module 里面找后缀是正则匹配js结尾的文件用use里面的装载机(是叫装载机吧?)编译一下,然后通过output输出到指定的目录并且定义一下输出后的文件名字~~
问题 : 这use里面的define-loader这个他通过什么路径找到这个的呢??是插件吗??问题我这个不是放再node-modules文件夹里面的,他怎么找的,还有下面的resolveLoader这个是什么啊???这个是说如果你再node_modules文件夹里面没找到就去loader文件夹里面找吗???
后来我百度了一下:use里面的基本都是插件去module里面找的~,然后如果是自定义的那就用resolveLoader属性封装一下,让他到你指定的目录下去找是吧....归纳的有点乱,百度上也没具体说明好像,
老师看看是这么理解吗??
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.