This commit is contained in:
nicco 2018-09-04 12:12:34 +02:00
parent 786d05116f
commit 717e145b00

70
src/cordova/webpack.config.js Executable file
View File

@ -0,0 +1,70 @@
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
module.exports = {
entry: [
'./index.jsx'
],
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'public')
},
resolve: {
extensions: ['.js', '.jsx']
},
context: path.resolve(__dirname, 'src'),
devServer: {
contentBase: path.resolve(__dirname, 'public/assets'),
open: true,
},
plugins: [
new HtmlWebpackPlugin({
template: 'index.html'
}),
new MiniCssExtractPlugin({
filename: 'bundle.css'
})
],
module: {
rules: [{
test: /\.jsx?$/,
include: /src/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-react', '@babel/preset-env']
}
}
}, {
test: /\.html$/,
use: ['html-loader']
}, {
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader']
}, {
test: /\.less$/,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'less-loader']
}, {
test: /\.(jpg|png|gif|svg)$/,
use: [{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: './assets/',
}
}]
}, {
test: /\.(ttf|eot|woff|woff2|otf)$/,
use: [{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: './assets/',
}
}]
}]
}
}