I've found this package yesterday and started using it following this tutorial.
When I open my app on browser it shows Uncaught SyntaxError: Unexpected token <. The app is loading with the correct hash. The error is pointing to <!DOCTYPE html>.
'use strict'
import express from 'express'
import path from 'path'
import favicon from 'serve-favicon'
import { readFileSync } from 'jsonfile'
// path for manifest json file
const manifestPath = `${process.cwd()}/public/build/manifest.json`
//read the manifest.json file
const manifest = readFileSync(manifestPath);
// js and css bundle maping to objects
const jsBundle = manifest['main.js'];
//import axios from 'axios'
//import store from './modules/store'
const app = express()
// view engine setup
app.set('views', path.join(__dirname, 'views'))
app.set('view engine', 'jade')
// config static dir
app.use(favicon(path.join(__dirname, 'public', 'images/favicon.ico')))
app.use(express.static(path.join(__dirname, 'public')))
// route handler
app.get('*', function (req, res) {
res.render('index', { title: 'Platform', jsBundle})
})
export default app
And finally this index.jade:
doctype html
html(lang='en')
head
meta(charset='utf-8')
meta(http-equiv='X-UA-Compatible', content='IE=edge')
meta(name='viewport', content='width=device-width, initial-scale=1')
title= title
meta(name='description', content='')
link(rel='stylesheet', href='/build/style.css')
body
#app
script(src=jsBundle)
script(async,src='https://maps.googleapis.com/maps/api/js?key=AIzaSyBp0nIBIEWDsSp2lagOzOX4zdPEanFaDM8&libraries=drawing,places&callback=mapsLoaded')
I've found this package yesterday and started using it following this tutorial.
When I open my app on browser it shows
Uncaught SyntaxError: Unexpected token <
. The app is loading with the correct hash. The error is pointing to<!DOCTYPE html>
.The following is my webpack configuration:
The following is my
manifest.json
output:The following is my
app.js
file:And finally this
index.jade
: