Last active
November 4, 2016 14:33
-
-
Save marshallformula/931299fe6e86b91374f7002e5598c204 to your computer and use it in GitHub Desktop.
webpack that includes assets in dev server
This file contains 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') | |
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