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

fix(render): Ensure only CSS and JS assets are rendered #238

Merged
merged 1 commit into from Dec 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions config/webpack/plugins/htmlRenderPlugin.js
@@ -1,4 +1,3 @@
const { partition } = require('lodash');
const HtmlRenderPlugin = require('html-render-webpack-plugin');

const renderScriptTag = require('../../../lib/renderScriptTag');
Expand Down Expand Up @@ -31,7 +30,9 @@ const mapStatsToParams = ({ webpackStats, routeName }) => {
? entrypoints[routeName].assets
: entrypoints[defaultClientEntry].assets;

const [styles, scripts] = partition(assets, asset => asset.endsWith('.css'));
const styles = assets.filter(asset => asset.endsWith('.css'));
const scripts = assets.filter(asset => asset.endsWith('.js'));

const bodyTags = scripts
.map(chunkFile =>
renderScriptTag(createPublicUrl(paths.publicPath, chunkFile))
Expand Down