Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[WIP] Webpack for Symfony
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var webpack = require('webpack');
var basedir = __dirname + '/src/Namespace/AppBundle/Resources/views/assets/';
var entry = {
// index: 'index',
user: 'User/user',
game: 'Game/game',
};
for(i in entry) {
entry[i] = basedir + entry[i];
}
module.exports = {
entry: entry,
output: {
path: "./web/",
filename: "[name].bundle.js",
chunkFilename: "[id].bundle.js"
},
module: {
loaders: [
{ test: /\.css$/, loader: "style!css" },
{ test: /\.scss/, loader: ExtractTextPlugin.extract("style", "css!sass") },
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin("commons", "commons.js", ["user", "game"]),
new ExtractTextPlugin("[name].bundle.css")
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment