CRONWMMM / multi_page_app_template

webpack4 + ejs + express 多页应用项目架构模板

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

<% if 报错

glhfwp opened this issue · comments

<div id="root">
    <div class="trans-center">
        <%if(title){%>
			<div>
				<%%= title %>
			</div>
			<div>
				<%%= __['word107'] %>
			</div>
        <%}%>
    </div>
</div>
ERROR in ./src/views/404.ejs (./node_modules/html-webpack-plugin/lib/loader.js!./src/views/404.ejs)
    Module Error (from ./node_modules/ejs-html-loader/lib/index.js):
    (Emitted value instead of an instance of Error) ejs-html-loader
    /Volumes/dev/me/LearnAll/myc/LearnNodeExpress/webpack-express-paydemo/src/views/404.ejs:13
        11|             <div class="trans-center">
        12|                     <!-- <div class="404">Not Found.</div> -->
     >> 13|                     <%if(title){%>
        14|                     <div>
        15|                             <%%= title %>
        16|                     </div>
    title is not defined

<%%= title %>写法是OK了,但是<%if(title){%> 报错该怎么办啊

<%% if(title){ %>

<%% } %>

这样试试看

已解决,谢谢了,写业务有点着急,以后我好好研究这块怎么个原理