第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

devserver里的vue代碼沒(méi)有打包

按照老師的課程學(xué)習(xí),npm run dev啟動(dòng)的devserver里css文件生效了,但是.vue文件的template和script代碼不生效,style樣式反而打包了。

webpack.config.js:

const?path?=?require('path');
//?const?{?VueLoaderPlugin?}?=?require("vue-loader");
const?VueLoaderPlugin?=?require('vue-loader/lib/plugin');
const?HTMLPlugin?=?require('html-webpack-plugin');
const?webpack?=?require('webpack');

const?isDev?=?process.env.NODE_ENV?===?'development'

const?config??=?{
??????target:'web',
??????entry:?path.join(__dirname,'src/index.js'),
??????output:{
??????????filename:?'bundle.js',
??????????path:?path.join(__dirname,'dist'),
??????},

?????module:{
???????????rules:[
???????????????{
???????????????????test:?/\.vue$/,
???????????????????loader:'vue-loader'
????????????????},
???????????????{
???????????????????test:?/\.css$/,
???????????????????//?loader:'style-loader!css-loader!postcss-loader',
???????????????????//?loaders:[]
???????????????????use:?[
???????????????????????'style-loader',
???????????????????????'css-loader'
???????????????????]
???????????????},
???????????????{
???????????????????test:?/\.styl/,
???????????????????use:?[
???????????????????????'style-loader',
???????????????????????'css-loader',
???????????????????????'stylus-loader'
???????????????????]
???????????????},
???????????????{
???????????????????test:?/\.(gif|jpg|jpeg|png|svg)$/,
???????????????????//?loader:'style-loader!css-loader!postcss-loader',
???????????????????//?loaders:[]
???????????????????use:?[
???????????????????????{
???????????????????????????loader:'url-loader',
???????????????????????????options:{
???????????????????????????????limit:1024,
???????????????????????????????name:'[name]-aaa.[ext]'
???????????????????????????}
???????????????????????}
???????????????????]
???????????????},
???????????],

?????},

????plugins:[
????????new?webpack.DefinePlugin({
????????????'process.env':{
????????????????NODE_ENV:?isDev???'"development"':?'"production"'
????????????}
????????}),
????????new?VueLoaderPlugin(),
????????new?HTMLPlugin()
????],

????//?mode:?'development'?//設(shè)置mode



}

if(isDev){
????config.devtool?=?'#cheap-module-eval-source-map'//瀏覽器調(diào)試
????config.devServer?=?{
????????port:8000,
????????host:'0.0.0.0',//別人的電腦也能訪問(wèn)到
????????overlay:{
????????????errors:?true,
????????},
????????open:?true,
????????//?historyFallback:{
????????//
????????//?},//沒(méi)有設(shè)置地址的路由映射到指定的地址,如index.html
????????hot:?true
????}
????config.plugins.push(
????????new?webpack.HotModuleReplacementPlugin(),
????????new?webpack.NodeEnvironmentPlugin()
????)//熱加載依賴
}

module.exports?=?config

index.js:

/**
?*?Created?by?59864?on?2020/10/11.
?*/
import?Vue?from?'vue'
import?App?from?'./app.vue'

import?'./assets/styles/test.css'
import?'./assets/styles/test-stylus.styl'
import?'./assets/images/1.png'

const?root?=?document.createElement('div')
document.body.appendChild(root)

new?Vue({
????render:?(h)?=>?(App)
}).$mount(root)

app.vue:

<template>
????<div?id="text">{{text}}
????<span>123</span>
????</div>

</template>

<script>
????export?default{
????????data(){
????????????return?{
????????????????text:'abc'
????????????}
????????},
????????mounted(){
????????????alert(1);
????????????console.log(123);
????????},
????}
</script>

<style>
#text{
????color:?black;
????width:?100px;
????height:?200px;
}
</style>

package.json:

{
??"name":?"vue-webpack",
??"version":?"1.0.0",
??"description":?"",
??"main":?"index.js",
??"scripts":?{
????"test":?"echo?\"Error:?no?test?specified\"?&&?exit?1",
????"build":?"cross-env?NODE_ENV=production?webpack?--config?webpack.config.js",
????"dev":?"cross-env?NODE_ENV=development?webpack-dev-server??--config?webpack.config.js"
??},
??"author":?"",
??"license":?"ISC",
??"dependencies":?{
????"cross-env":?"^7.0.2",
????"file-loader":?"^6.2.0",
????"html-webpack-plugin":?"^4.5.0",
????"stylus":?"^0.54.8",
????"stylus-loader":?"^4.2.0",
????"url-loader":?"^4.1.1",
????"vue":?"^2.6.12",
????"vue-loader":?"^15.9.5",
????"vue-template-compiler":?"^2.6.12",
????"webpack":?"^4.32.2"
??},
??"devDependencies":?{
????"css-loader":?"^4.3.0",
????"style-loader":?"^2.0.0",
????"webpack-cli":?"^3.3.2",
????"webpack-dev-server":?"^3.5.1"
??}
}

正在回答

1 回答

這個(gè)開(kāi)發(fā)環(huán)境下不需要打包的

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

devserver里的vue代碼沒(méi)有打包

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)