Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to add hash code in production env #311

Closed
chenkang084 opened this issue Jun 23, 2017 · 9 comments
Closed

how to add hash code in production env #311

chenkang084 opened this issue Jun 23, 2017 · 9 comments

Comments

@chenkang084
Copy link

since we need clean cache via hash file name ,how to add hash code in .roadhogrd or webpack.config.js

@zocodo
Copy link

zocodo commented Jun 24, 2017

webpack.config.js
image

@chenkang084
Copy link
Author

chenkang084 commented Jun 25, 2017

thx for your solution, it can generate three *.js files, looks good.
Alt text
but how could we inject the files into index.html by roadhog ,just like using

new HtmlWebpackPlugin({
            filename: './index.html',
            template: __dirname + "/src/index.html"
        }),

i have tried to config HtmlWebpackPlugin, but failed .
could you show me how to inject hash file dynamically ?

@zocodo
Copy link

zocodo commented Jun 25, 2017

when use html-webpack-plugin in roadhog, error: Cannot read property '0' of undefined
So I wrote a business-related plugin
My English is not good

@chenkang084
Copy link
Author

chenkang084 commented Jun 25, 2017

我这边可以正确添加HtmlWebpackPlugin,但是,添加进去之后,没法正常读到 index.html。我试了很久,大概是 roadhog 用的是file loader处理html。我在我以前的项目中,用的是 html-loader 处理index.html ,这样是正常的。
方便留个qq/email/wechat,我们可以一起探讨。
[email protected]

@zocodo
Copy link

zocodo commented Jun 26, 2017

使用 HtmlWebpackPlugin 应该和 html-loader 无关吧, 我没用过这个 ,html-loader 不是用来处理 import 到 js 里面的 html 文件的吗?

@trexguo
Copy link

trexguo commented Jun 26, 2017

new HtmlWebpackPlugin({
            filename: './index.html',
            template: __dirname + "/src/index.html",
}),

inject: true | 'head' | 'body' | false Inject all assets into the given template or templateContent - When passing true or 'body' all javascript resources will be placed at the bottom of the body element. 'head' will place the scripts in the head element.

@chenkang084
Copy link
Author

i have tried the method before .but failed. have you successfully use the solution ?
could you share me the url or screenshot ?

@zocodo
Copy link

zocodo commented Jun 27, 2017

What the roadhog version do you use? @trexguo

@chenkang084
Copy link
Author

@MrChongdong 似乎解决了。参考231

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants