@talentsoft-opensource/widget-display-tool
Version:
Widget Simulator
79 lines (77 loc) • 2.69 kB
JavaScript
var path = require('path');
var CopyPlugin = require('copy-webpack-plugin');
var WriteFilePlugin = require('write-file-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
module.exports = env => {
return {
mode: 'development',
context: __dirname,
entry: [
__dirname + "/src/index.tsx"
],
output: {
path: path.resolve(__dirname, "build"),
filename: "widget.bundle.js"
},
devServer: {
contentBase: path.resolve(__dirname, "build"),
port: 5555
},
plugins: [
new CopyPlugin([
{from: env.bundleFile, to: __dirname + '/build/integration.bundle.js'},
{from: env.mockFile, to: __dirname + '/build/mock.js'},
{
from: require.resolve('@talentsoft-opensource/integration-dll/dist/integration.dll.js'),
to: __dirname + '/build/integration.dll.js'
},
{
from: require.resolve('@talentsoft-opensource/display-tool-widget-mock/dist/main.bundle.js'),
to: __dirname + '/build/widget.mock.bundle.js'
}
]),
new WriteFilePlugin(),
new CleanWebpackPlugin(
[path.resolve(__dirname, 'build')],
{exclude: ['index.html']}),
],
resolve: {
extensions: ['.ts', '.js', '.tsx']
},
module: {
rules: [
{
test: /\.less$/,
use: [{
loader: 'style-loader' // creates style nodes from JS strings
}, {
loader: 'css-loader' // translates CSS into CommonJS
}, {
loader: 'less-loader' // compiles Less to CSS
}]
},
{
test: /\.tsx?$/,
use: 'ts-loader',
},
{
test: /\.(woff|woff2|eot|ttf|svg)$/,
include: /node_modules/,
loader: "file-loader",
options: {
name: "dist/assets/fonts/[name].[ext]",
publicPath: ""
}
},
{
test: /\.(svg|png|jpg|gif)$/,
loader: "file-loader",
options: {
name: "assets/images/[name].[ext]",
publicPath: ""
}
},
]
}
}
};