Compare commits
3 Commits
detect-ima
...
windows-bu
Author | SHA1 | Date | |
---|---|---|---|
1ace858bfe | |||
0388bde540 | |||
26fb713560 |
@ -17,6 +17,8 @@ const CrittersPlugin = require('critters-webpack-plugin');
|
|||||||
const AssetTemplatePlugin = require('./config/asset-template-plugin');
|
const AssetTemplatePlugin = require('./config/asset-template-plugin');
|
||||||
const addCssTypes = require('./config/add-css-types');
|
const addCssTypes = require('./config/add-css-types');
|
||||||
|
|
||||||
|
const regexpPathSep = path.sep === '\\' ? '\\\\' : '/';
|
||||||
|
|
||||||
function readJson (filename) {
|
function readJson (filename) {
|
||||||
return JSON.parse(fs.readFileSync(filename));
|
return JSON.parse(fs.readFileSync(filename));
|
||||||
}
|
}
|
||||||
@ -38,7 +40,7 @@ module.exports = async function (_, env) {
|
|||||||
return {
|
return {
|
||||||
mode: isProd ? 'production' : 'development',
|
mode: isProd ? 'production' : 'development',
|
||||||
entry: {
|
entry: {
|
||||||
'first-interaction': './src/index'
|
'first-interaction': path.join('.', 'src', 'index'),
|
||||||
},
|
},
|
||||||
devtool: isProd ? 'source-map' : 'inline-source-map',
|
devtool: isProd ? 'source-map' : 'inline-source-map',
|
||||||
stats: 'minimal',
|
stats: 'minimal',
|
||||||
@ -52,13 +54,13 @@ module.exports = async function (_, env) {
|
|||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.ts', '.tsx', '.mjs', '.js', '.scss', '.css'],
|
extensions: ['.ts', '.tsx', '.mjs', '.js', '.scss', '.css'],
|
||||||
alias: {
|
alias: {
|
||||||
style: path.join(__dirname, 'src/style')
|
style: path.join(__dirname, 'src', 'style')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
resolveLoader: {
|
resolveLoader: {
|
||||||
alias: {
|
alias: {
|
||||||
// async-component-loader returns a wrapper component that waits for the import to load before rendering:
|
// async-component-loader returns a wrapper component that waits for the import to load before rendering:
|
||||||
async: path.join(__dirname, 'config/async-component-loader')
|
async: path.join(__dirname, 'config', 'async-component-loader')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
@ -147,11 +149,11 @@ module.exports = async function (_, env) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
// All the codec files define a global with the same name as their file name. `exports-loader` attaches those to `module.exports`.
|
// All the codec files define a global with the same name as their file name. `exports-loader` attaches those to `module.exports`.
|
||||||
test: /\/codecs\/.*\.js$/,
|
test: new RegExp(`${regexpPathSep}codecs${regexpPathSep}.*\.js`),
|
||||||
loader: 'exports-loader'
|
loader: 'exports-loader'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\/codecs\/.*\.wasm$/,
|
test: new RegExp(`${regexpPathSep}codecs${regexpPathSep}.*\.wasm`),
|
||||||
// This is needed to make webpack NOT process wasm files.
|
// This is needed to make webpack NOT process wasm files.
|
||||||
// See https://github.com/webpack/webpack/issues/6725
|
// See https://github.com/webpack/webpack/issues/6725
|
||||||
type: 'javascript/auto',
|
type: 'javascript/auto',
|
||||||
@ -172,7 +174,7 @@ module.exports = async function (_, env) {
|
|||||||
plugins: [
|
plugins: [
|
||||||
new webpack.IgnorePlugin(
|
new webpack.IgnorePlugin(
|
||||||
/(fs|crypto|path)/,
|
/(fs|crypto|path)/,
|
||||||
new RegExp(`${path.sep}codecs${path.sep}`)
|
new RegExp(`${regexpPathSep}codecs${regexpPathSep}`)
|
||||||
),
|
),
|
||||||
|
|
||||||
// Pretty progressbar showing build progress:
|
// Pretty progressbar showing build progress:
|
||||||
|
Reference in New Issue
Block a user