Created
March 22, 2017 19:00
-
-
Save MattMcNam/3cdef529afe95649a575ecde23bfea6e to your computer and use it in GitHub Desktop.
webpack + nodecg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const app = express(); | |
const {NODE_ENV} = process.env; | |
module.exports = function(nodecg) { | |
if (NODE_ENV !== 'production') { | |
const webpack = require('webpack'); | |
const webpackConfig = require('../webpack.dev.config'); | |
const devMiddleware = require('webpack-dev-middleware'); | |
const compiler = devMiddleware(webpack(webpackConfig), { | |
publicPath: webpackConfig.output.publicPath, | |
stats: {colors: true}, | |
log: nodecg.log | |
}); | |
app.use(compiler); | |
} | |
nodecg.mount(app); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
<script src="graphic.min.js"></script> | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
"scripts": { | |
"build": "webpack --progress -p" | |
} | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const webpack = require('webpack'); | |
module.exports = { | |
context: path.join(__dirname, 'graphics'), // This... | |
devtool: "inline-sourcemap", | |
entry: './js/index.js', | |
output: { | |
path: path.join(__dirname, 'graphics'), // this... | |
publicPath: '/graphics/tagg-stack/', // and this are the important lines | |
filename: 'graphic.min.js' | |
}, | |
plugins: [ | |
new webpack.NoEmitOnErrorsPlugin() | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment