- Vue.js 2 Design Patterns and Best Practices
- Paul Halliday
- 138字
- 2021-06-24 18:33:05
Vue-loader
Inside of our ./webpack-config.js within the standard webpack-simple template, we have a module object that allows us to set up our loader; this tells Webpack that we'd like it to use .vue files inside of our project:
module: {
rules: [{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {}
// other vue-loader options go here
}
}]
For this to work, Webpack runs a regular expression for anything that matches .vue and then passes this to our vue-loader to be transformed into a plain JavaScript module. In this simple example, we're loading files with a .vue extension, but vue-loader can be further customized and you may want to look into this further (https://goo.gl/4snNfD). We could certainly do this configuration ourselves, but hopefully, you can see the benefits of using the Vue CLI to generate our Webpack projects.
推薦閱讀
- 面向物聯(lián)網(wǎng)的CC2530與傳感器應(yīng)用開(kāi)發(fā)
- 物聯(lián)網(wǎng)安全:理論、實(shí)踐與創(chuàng)新
- 5G承載網(wǎng)網(wǎng)絡(luò)規(guī)劃與組網(wǎng)設(shè)計(jì)
- 網(wǎng)絡(luò)故障現(xiàn)場(chǎng)處理實(shí)踐(第4版)
- Hands-On Full Stack Development with Spring Boot 2 and React(Second Edition)
- 無(wú)人機(jī)通信
- 網(wǎng)絡(luò)互聯(lián)技術(shù)(實(shí)踐篇)
- 網(wǎng)絡(luò)安全技術(shù)與解決方案(修訂版)
- SSL VPN : Understanding, evaluating and planning secure, web/based remote access
- 數(shù)字通信同步技術(shù)的MATLAB與FPGA實(shí)現(xiàn):Altera/Verilog版(第2版)
- C/C++串口通信:典型應(yīng)用實(shí)例編程實(shí)踐
- 通信十年:擁抱互聯(lián)網(wǎng)
- 云工廠:開(kāi)啟中國(guó)制造云時(shí)代
- Selenium WebDriver 3 Practical Guide
- 移動(dòng)互聯(lián)網(wǎng)新思維