You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
WebCAD/webpack.config.js

75 lines
2.4 KiB

var path = require('path');
var HtmlWebPackPlugin = require("html-webpack-plugin");
var AddAssetHtmlPlugin = require("add-asset-html-webpack-plugin");
var ExtractTextPlugin = require('extract-text-webpack-plugin');
const webpack = require('webpack');
module.exports = {
entry: "./src/index.tsx",
output: {
filename: "bundle.js",
path: path.resolve(__dirname, 'dist')
},
// Enable sourcemaps for debugging webpack's output.
devtool: "source-map",
resolve: {
alias: {
"dat.gui": path.resolve(__dirname, './node_modules/dat.gui/build/dat.gui.js'),
"stats-js": path.resolve(__dirname, './node_modules/stats.js/src/stats.js')
},
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: [".ts", ".tsx", ".js", "json"]
},
module: {
loaders: [
// All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
{ test: /\.tsx?$/, loader: "awesome-typescript-loader" },
{ test: /\.[(png)|(jpg)|(obj)]$/, loader: "file-loader" },
{
test: /\.css$/,
//use: ['style-loader', 'css-loader']
use: ExtractTextPlugin.extract({
use: 'css-loader'
})
},
{
test: /\.less$/,
use:
[
{
loader: "style-loader"
},
{
loader: "css-loader"
},
{
loader: "less-loader", options:
{
strictMath: true,
noIeCompat: true
}
}
]
}
]
},
// externals: {
// "react": "React",
// "react-dom": "ReactDOM"
// },
// Other options...
devServer: {
contentBase: path.join(__dirname, "dist"),
compress: true,
port: 8188
},
plugins: [
new webpack.DllReferencePlugin({
context: '.',
manifest: require(path.resolve(__dirname, "./manifest.json"))
}),
new HtmlWebPackPlugin({ title: "webCAD" }),
new AddAssetHtmlPlugin({ filepath: path.resolve(__dirname, "./dist/dll.js") }),
new ExtractTextPlugin('styles.css'),
]
};