Created
December 28, 2017 05:11
-
-
Save vladimir-e/8c6225e4b266f72c34fd3426d6b98379 to your computer and use it in GitHub Desktop.
Basic webpack setup for phoenix project
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 ExtractTextPlugin = require("extract-text-webpack-plugin"); | |
const CopyWebpackPlugin = require("copy-webpack-plugin"); | |
module.exports = { | |
entry: ["./css/web.css", "./js/web.js"], | |
output: { | |
path: path.resolve(__dirname, "../priv/static"), | |
filename: "js/web.js" | |
}, | |
devtool: 'source-map', | |
resolve: { | |
modules: [ "node_modules", path.resolve(__dirname, "js") ] | |
}, | |
module: { | |
loaders: [{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
loader: "babel-loader", | |
include: __dirname, | |
query: { | |
presets: ["babel-preset-es2015", "babel-preset-env"].map(require.resolve) | |
} | |
}, { | |
test: /\.css$/, | |
use: ExtractTextPlugin.extract({ | |
fallback: "style-loader", | |
use: [{ | |
loader: 'css-loader' | |
}, { | |
loader: 'sass-loader' | |
}] | |
}), | |
}, { | |
test: /\.scss$/, | |
use: ExtractTextPlugin.extract({ | |
fallback: "style-loader", | |
use: [{ | |
loader: 'css-loader' | |
}, { | |
loader: 'sass-loader' | |
}] | |
}), | |
}] | |
}, | |
plugins: [ | |
new ExtractTextPlugin("css/web.css"), | |
new CopyWebpackPlugin([{ from: "./static" }]) | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment