mirror of
https://github.com/maputnik/editor.git
synced 2025-12-30 10:00:02 +00:00
Initial commit
This commit is contained in:
74
webpack.config.js
Normal file
74
webpack.config.js
Normal file
@@ -0,0 +1,74 @@
|
||||
"use strict";
|
||||
var webpack = require('webpack');
|
||||
var path = require('path');
|
||||
var loaders = require('./webpack.loaders');
|
||||
var HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
|
||||
const HOST = process.env.HOST || "127.0.0.1";
|
||||
const PORT = process.env.PORT || "8888";
|
||||
|
||||
// global css
|
||||
loaders.push({
|
||||
test: /[\/\\](node_modules|global)[\/\\].*\.css$/,
|
||||
loaders: [
|
||||
'style?sourceMap',
|
||||
'css'
|
||||
]
|
||||
});
|
||||
// local scss modules
|
||||
loaders.push({
|
||||
test: /[\/\\]src[\/\\].*\.scss/,
|
||||
loaders: [
|
||||
'style?sourceMap',
|
||||
'css?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]',
|
||||
'sass'
|
||||
]
|
||||
});
|
||||
|
||||
// local css modules
|
||||
loaders.push({
|
||||
test: /[\/\\]src[\/\\].*\.css/,
|
||||
loaders: [
|
||||
'style?sourceMap',
|
||||
'css?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]'
|
||||
]
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
entry: [
|
||||
`webpack-dev-server/client?http://${HOST}:${PORT}`,
|
||||
`webpack/hot/only-dev-server`,
|
||||
`./src/index.jsx` // Your appʼs entry point
|
||||
],
|
||||
devtool: process.env.WEBPACK_DEVTOOL || 'cheap-module-source-map',
|
||||
output: {
|
||||
path: path.join(__dirname, 'public'),
|
||||
filename: 'bundle.js'
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['', '.js', '.jsx']
|
||||
},
|
||||
module: {
|
||||
loaders
|
||||
},
|
||||
devServer: {
|
||||
contentBase: "./public",
|
||||
// do not print bundle build stats
|
||||
noInfo: true,
|
||||
// enable HMR
|
||||
hot: true,
|
||||
// embed the webpack-dev-server runtime into the bundle
|
||||
inline: true,
|
||||
// serve index.html in place of 404 responses to allow HTML5 history
|
||||
historyApiFallback: true,
|
||||
port: PORT,
|
||||
host: HOST
|
||||
},
|
||||
plugins: [
|
||||
new webpack.NoErrorsPlugin(),
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
new HtmlWebpackPlugin({
|
||||
template: './src/template.html'
|
||||
}),
|
||||
]
|
||||
};
|
||||
Reference in New Issue
Block a user