Skip to content

Instantly share code, notes, and snippets.

@marshallformula
Last active November 4, 2016 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marshallformula/931299fe6e86b91374f7002e5598c204 to your computer and use it in GitHub Desktop.
Save marshallformula/931299fe6e86b91374f7002e5598c204 to your computer and use it in GitHub Desktop.
webpack that includes assets in dev server
const path = require('path')
const webpack = require('webpack')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const dest = path.resolve(__dirname, '../', '../', 'resources/static')
module.exports = {
entry: {
app: ['./src/index.js']
},
output: {
path: dest,
filename: '[name].js'
},
module: {
loaders: [
{
test: /\.(css|less)$/,
loaders: ['style', 'css', 'less']
},
{
test: /\.html$/,
exclude: /node_modules/,
loader: 'file?name=[name].[ext]'
},
{
test: /\.elm$/,
exclude: /node_modules/,
loader: 'elm-webpack'
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url-loader?limit=10000&mimetype=application/font-woff'
},
{
test: /\.(ttf|eot|svg|png|jpg|jpeg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file'
}
],
noParse: /\.elm$/
},
plugins: [
new webpack.DefinePlugin({
REST_URL : JSON.stringify(process.env.REST_URL || "/api/v1")
}),
new CopyWebpackPlugin([
{
from: 'src/assets',
to: dest
}
])
],
devServer: {
inline: true,
stats: { colors: true },
historyApiFallback: true,
outputPath: dest
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment