summaryrefslogtreecommitdiff
path: root/@linaria/website/webpack.config.js
diff options
context:
space:
mode:
Diffstat (limited to '@linaria/website/webpack.config.js')
-rw-r--r--@linaria/website/webpack.config.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/@linaria/website/webpack.config.js b/@linaria/website/webpack.config.js
new file mode 100644
index 0000000..47427f5
--- /dev/null
+++ b/@linaria/website/webpack.config.js
@@ -0,0 +1,57 @@
+const path = require('path');
+const webpack = require('webpack'); // eslint-disable-line import/no-extraneous-dependencies
+const MiniCssExtractPlugin = require('mini-css-extract-plugin'); // eslint-disable-line import/no-extraneous-dependencies
+
+const dev = process.env.NODE_ENV !== 'production';
+
+module.exports = {
+ mode: dev ? 'development' : 'production',
+ devtool: 'source-map',
+ entry: {
+ app: './src/index',
+ },
+ output: {
+ path: path.resolve(__dirname, 'dist'),
+ publicPath: '/dist/',
+ filename: '[name].bundle.js',
+ },
+ optimization: {
+ noEmitOnErrors: true,
+ },
+ plugins: [
+ new webpack.DefinePlugin({
+ 'process.env': { NODE_ENV: JSON.stringify(process.env.NODE_ENV) },
+ }),
+ new MiniCssExtractPlugin({ filename: 'styles.css' }),
+ ],
+ module: {
+ rules: [
+ {
+ test: /\.js$/,
+ exclude: /node_modules/,
+ use: [
+ { loader: 'babel-loader' },
+ {
+ loader: require.resolve('@linaria/webpack4-loader'),
+ options: { sourceMap: dev },
+ },
+ ],
+ },
+ {
+ test: /\.css$/,
+ use: [
+ 'css-hot-loader',
+ MiniCssExtractPlugin.loader,
+ {
+ loader: 'css-loader',
+ options: { sourceMap: dev },
+ },
+ ],
+ },
+ {
+ test: /\.(png|jpg|gif|svg)$/,
+ use: [{ loader: 'file-loader' }],
+ },
+ ],
+ },
+};