48 lines
1009 B
JavaScript
48 lines
1009 B
JavaScript
const webpack = require('webpack');
|
|
const path = require('path');
|
|
|
|
module.exports = {
|
|
entry: { main: './main.js' },
|
|
context: __dirname,
|
|
output: {
|
|
path: __dirname,
|
|
filename: '[name].c.js'
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /.jsx?$/,
|
|
loader: 'babel-loader',
|
|
exclude: /node_modules/,
|
|
options: {
|
|
presets: [ "env", "stage-1", "react" ],
|
|
retainLines: true,
|
|
}
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
use: [
|
|
"style-loader",
|
|
{
|
|
loader: "css-loader",
|
|
options: {
|
|
modules: true, // default is false
|
|
sourceMap: true,
|
|
importLoaders: 1,
|
|
localIdentName: "[name]--[local]--[hash:base64:8]"
|
|
}
|
|
},
|
|
"postcss-loader"
|
|
]
|
|
}
|
|
]
|
|
},
|
|
plugins: [
|
|
new webpack.DefinePlugin({
|
|
"process.env": {
|
|
NODE_ENV: JSON.stringify(process.env.NODE_ENV || "production")
|
|
}
|
|
})
|
|
]
|
|
};
|