Skip to content

Commit 2e42caf

Browse files
committed
build FF extension using craco
1 parent 4cadf79 commit 2e42caf

2 files changed

Lines changed: 42 additions & 3 deletions

File tree

craco.config.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
module.exports = {
2+
webpack: {
3+
configure: {
4+
output: {
5+
filename: 'static/js/[name].js',
6+
},
7+
optimization: {
8+
runtimeChunk: false,
9+
splitChunks: {
10+
chunks(chunk) {
11+
return false
12+
},
13+
},
14+
},
15+
},
16+
},
17+
plugins: [
18+
{
19+
plugin: {
20+
overrideWebpackConfig: ({ webpackConfig }) => {
21+
let mcep
22+
webpackConfig.plugins.some((p) => {
23+
if (p.constructor.name === 'MiniCssExtractPlugin') {
24+
mcep = p
25+
return true
26+
}
27+
})
28+
if (mcep) {
29+
mcep.options.filename = 'static/css/[name].css'
30+
}
31+
32+
return webpackConfig
33+
},
34+
},
35+
options: {},
36+
},
37+
],
38+
}

script/stores_build.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ stores_build() {
1010

1111
rm -f source_code.zip
1212
rm -f extension.zip
13-
14-
react-scripts build
13+
14+
yarn global add @craco/craco
15+
craco build
1516

1617
mkdir -p dist
1718
cp -r build/* dist
1819
echo 'zipping the dist'
1920
cd dist/ && zip -r ../extension.zip * -x "*.DS_Store" && cd ..
2021

2122
echo 'zipping the source code for Firefox'
22-
zip -r source_code.zip 'public/' 'script/' 'src' 'LICENCE' 'package.json' 'yarn.lock' 'README.md' -x "*.DS_Store"
23+
zip -r source_code.zip 'public/' 'script/' 'src' 'LICENSE' 'package.json' 'yarn.lock' 'README.md' -x "*.DS_Store"
2324
}
2425

2526
stores_build

0 commit comments

Comments
 (0)