diff --git a/src/cordova/webpack.config.js b/src/cordova/webpack.config.js new file mode 100755 index 0000000..4c43ce0 --- /dev/null +++ b/src/cordova/webpack.config.js @@ -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/', + } + }] + }] + } +} \ No newline at end of file