Skip to content

Instantly share code, notes, and snippets.

@BinaryMuse
Last active August 29, 2019 13:44
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save BinaryMuse/eca62986656e89e39efd to your computer and use it in GitHub Desktop.
Save BinaryMuse/eca62986656e89e39efd to your computer and use it in GitHub Desktop.
webpack less -> css with source maps via extracttextplugin
var webpack = require("webpack");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var lessLoader = ExtractTextPlugin.extract(
"css?sourceMap!less?sourceMap"
);
module.exports = {
cache: true,
entry: { bundle: "./master/client/index.jsx" },
output: {
path: __dirname + "/master/public/js",
filename: "[name].js"
},
devtool: "source-map",
resolve: {
extensions: ["", ".webpack.js", ".web.js", ".js", ".jsx"]
},
module: {
loaders: [
{ test: /\.less$/, exclude: /node_modules/, loader: lessLoader },
{ test: /\.(eot|svg|ttf|woff|woff2)$/, exclude: /node_modules/, loader: "file" },
{ test: /\.jsx?$/, exclude: /node_modules/, loader: "babel?stage=1" }
]
},
plugins: [
new ExtractTextPlugin("styles.css", {allChunks: true})
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment