-
-
Notifications
You must be signed in to change notification settings - Fork 503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use-ts-loader recipe not working #422
Comments
@fs86 sorry for the long delay. It looks like your demo repo isn't available anymore. Can you recreate it? |
I'm using a revised code not occuring any bug, but transformation never be happened. When I trace the For reference, version of const craco = require("@craco/craco");
const webpack = require("webpack");
const transform = require("typescript-json/lib/transform").default;
const throwError = (message) =>
craco.throwUnexpectedConfigError({
packageName: "craco",
githubRepo: "gsoft-inc/craco",
message,
githubIssueQuery: "webpack",
});
module.exports = {
webpack: {
plugins: [
new webpack.DefinePlugin({
process: {
env: {}
}
}),
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"],
}),
],
configure: (config) => {
// ADD TS-LOADER
const { isAdded: tsLoaderIsAdded } = craco.addBeforeLoader(
config,
craco.loaderByName("babel-loader"),
{
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
loader: "ts-loader",
options: {
// TRANSFORMED, BUT NOT BUNDLED
getCustomTransformers: (program) => {
console.log(program.getSourceFiles()); // NO FILE
return {
before: [transform(program)],
}
},
},
},
);
if (!tsLoaderIsAdded) throwError("failed to add ts-loader");
// REMOVE BABEL
const { hasRemovedAny, removedCount } = craco.removeLoaders(
config,
craco.loaderByName("babel-loader"),
);
if (!hasRemovedAny) throwError("no babel-loader to remove");
if (removedCount !== 2)
throwError("had expected to remove 2 babel loader instances");
return config;
},
},
}; |
Anyone get this same issue? (Edit: gonna take that as a no, looks like it's eject time! Don't know why everyone is so afraid of ejecting... sounds a little uninformed) |
The use-ts-loader recipe (https://github.com/gsoft-inc/craco/blob/master/recipes/use-ts-loader/craco.config.js) does not seem to work correctly. The url-loader is not found and the process terminates at line 37. I have prepared an example repository where the error is reproducible: https://github.com/fs86/use-ts-loader
EDIT:
Is this possibly related to the missing CRA5 support?
The text was updated successfully, but these errors were encountered: