Error : unable to locate after build
EmericHochart opened this issue · comments
Hello,
Someone can help me to resolve this :
After build :
npm run build && npm run upload
apps-script-starter@4.18.0 build C:\Emeric\Polyvalence\gestion-polyvalence
webpack
LOG from copy-webpack-plugin
unable to locate 'C:\Emeric\Polyvalence\gestion-polyvalence\functions*.js' at 'C:\Emeric\Polyvalence\gestion-polyvalence\functions*.js'
unable to locate 'C:\Emeric\Polyvalence\gestion-polyvalence\src**.html' at 'C:\Emeric\Polyvalence\gestion-polyvalence\src**.html'
- 21 hidden lines
ERROR in unable to locate 'C:\Emeric\Polyvalence\gestion-polyvalence\functions*.js' at 'C:\Emeric\Polyvalence\gestion-polyvalence\functions*.js'
ERROR in unable to locate 'C:\Emeric\Polyvalence\gestion-polyvalence\src**.html' at 'C:\Emeric\Polyvalence\gestion-polyvalence\src**.html'
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! apps-script-starter@4.18.0 build: webpack
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the apps-script-starter@4.18.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
seems to be a problem with my path
functions*.js
src**.html
Issue For Window User :
new CopyWebpackPlugin({
patterns: [
{
from: path.posix.join(path.resolve(__dirname,'src').replace(/\/g, '/'), '**/.html'),
flatten: true,
to: destination
},
{
from: ${src}/../appsscript.json
,
to: destination,
},
{
from: path.posix.join(path.resolve(__dirname,'src').replace(/\/g, '/'), '../functions/.js'),
to: destination,
flatten: true,
},
],
}),
Thanks to @lauthieb
Having the same issue on windows. How did you fix it?
Figured it out. @EmericHochart 's code had some syntax errors, once fixed it found the files correctly:
In webpack.config.js:
new CopyWebpackPlugin({
patterns: [
{
from: path.posix.join(
path.resolve(__dirname,'src').replace(/\/g, '/'),
'**/.html'),
flatten: true,
to: destination
},
{
from: ${src}/../appsscript.json
,
to: destination
},
{
from: path.posix.join(path.resolve(__dirname,'src').replace(/\/g, '/'), '../functions/.js'),
to: destination,
flatten: true
},
],
}),
From: https://www.npmjs.com/package/copy-webpack-plugin should be using the path methods to find the files and not absolute references as they differ on windows/mac. This change works correctly for me on Windows, need someone on a mac to test that it works correctly there was well. I'll make a pull request.
Resolved in the new build. Thanks @Zireael13