Comments (7)
I see the problem, right now you can use:
"scripts": {
"build": "WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG=1 NODE_ENV=production NODE_OPTIONS='--import tsimp/import' webpack --disable-interpret"
},
Anyway you still have some problems with ts/babel configuration.
Using --disable-interpret
you will disable built-in behaviour and using WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG
you are saying to load configuration as ESM.
Feel free to feedback
from webpack-cli.
This worked for me! Thanks!
from webpack-cli.
NODE_ENV=production NODE_OPTIONS='--loader=tsimp/loader' webpack
works fine for me locally without any problem, expect experimental message, check your enviroment, looks like you don't have installed tsimp
Here docs - https://github.com/tapjs/tsimp?tab=readme-ov-file#usage, supported ESM --import
is still under experiments
Close due #3905
Feel free to feedback
from webpack-cli.
@alexander-akait Unfortunately, this does not work. --loader
or --import
, doesn't make a diffetence. I double checked, I do have tsimp installed correctly. Still getting:
[webpack-cli] Unable load '/app/webpack.config.ts'
[webpack-cli] Unable to use specified module loaders for ".ts".
[webpack-cli] Cannot find module 'ts-node/register' from '/app'
[webpack-cli] Cannot find module 'sucrase/register/ts' from '/app'
[webpack-cli] Cannot find module '@babel/register' from '/app'
[webpack-cli] Cannot find module 'esbuild-register/dist/node' from '/app'
[webpack-cli] Cannot find module '@swc/register' from '/app'
[webpack-cli] Please install one of them
I have also tried adding --disable-interpret
, hoping that maybe it could resolve the issue for me, but to no avail.
from webpack-cli.
@wojtekmaj strange, maybe you can create a reproducible repo? Because it works locally for me, also please check your version
from webpack-cli.
There is absolutely nothing unusual about my setup. Here's my minimal repro repo:
However, I believe the key is that you may have one of the listed packages ('ts-node/register', 'sucrase/register/ts', '@babel/register', 'esbuild-register/dist/node', '@swc/register') installed alongside tsimp, causing the error not to appear.
from webpack-cli.
Anyway in future we will improve it and you will need less extra code to run it, we are waiting interpret
developers, also we need support --import
syntax on the interpret
side (right now only register
wroks)
from webpack-cli.
Related Issues (20)
- Incorrect warning about watch command HOT 4
- while calling remote app getting [object object] i used webpack when i open separate it's work fine but when open in host app and call remote app getting error [object object] HOT 1
- webpack-dev-server doesn't work with installed webpack and webpack-cli in the parent folder HOT 7
- Import error after updating to v5.1.2 HOT 3
- Accept `undefined` and `null` in `plugins` array HOT 3
- Chore: Update dependencies
- Project HOT 1
- Unable to specify custom config loader in Node 20 (`--loader tsx`) HOT 2
- @webpack-cli/[email protected] has some deprecated NPM modules HOT 3
- debuglog: Package no longer supported. HOT 2
- @npmcli/move-file: This functionality has been moved to @npmcli/fs HOT 1
- `esbuild-kit/tsx` loader support for TypeScript configuration HOT 6
- Cannot read properties of undefined (reading 'getArguments') HOT 13
- Feature request: Include testing of updating dependencies in a readme
- With default config, the webpack serve does not serve the images in html HOT 5
- `--node-env` doesn't set the `mode` as expected HOT 3
- Cannot Get Rid Of "Module not found: Error: Can't resolve 'fs/promises'" HOT 1
- webpack-cli wants `@swc/register` but it is deprecated for `@swc-node/register` HOT 2
- process.loadEnvFile(); fails to load HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webpack-cli.