Releases: egoist/poi
[email protected]
v12.6.1
Release notes: https://changelog.egoist.sh/poi/whats-new-in-v12.6.1
v12.6.0
Release notes: https://changelog.egoist.sh/poi/whats-new-in-v12.6.1
v12.4.6
v12.4.2
Features
- create-poi-app: add
pnp
feature
Fixes
- poi: Support Yarn plug'n'play
v12.4.0
Features
- Now a command called
test
or starts withtest:
will automatically run intest
mode, therefore the@poi/plugin-karma
now uses the commandpoi test:unit
instead ofpoi karma --test
. - A new hook to run before command:
api.hook('beforeRun', () => Promise<void> | void)
- Display memory usage under
--serve
Fixes
- Respect
process.env.HOST
andprocess.env.PORT
- Dev client ES5 compatibility
- A bug with
output.publicUrl: './'
under--serve
v12.2.0
🔥🔥 New Features 🔥🔥
No plugin needed for ReasonML
@poi/plugin-reason
is deprecated since now you can just install @poi/bs-loader
and your ReasonML app is good to build!
Convert named imports to use custom webpack loaders experimental
This is a new feature in our default babel preset. It does following things:
// .svg
import logoUrl, { ReactComponent as Logo } from './logo.svg'
// 👇👇👇
import logoUrl from './logo.svg'
import Logo from '!svgr/webpack!./logo.svg'
render(<Logo />, document.getElementById('app'))
// .md
import { ReactComponent } from './post.md'
// 👇👇👇
import ReactComponent from '!a-long-loader-chain!./post.md'
If you get an error that says some loader is missing, you need to install it.
Basically when you import ReactComponent
from a .svg
file or .md
file, we use a babel plugin to add corresponding webpack loaders in front of the source path.
By default we support following named imports:
.svg
: SupportsReactComponent
import, of course thedefault
import still works, it returns the path to the SVG file..md
: SupportsReactComponent
import.
Check out this to see the default config for this feature.
You can also extend this feature:
// poi.config.js
module.exports = {
babel: {
namedImports: {
md: {
default: '!file-loader![path]',
html: '!markdown-loader![path]'
}
}
}
}
Then in your JS file you can import default
and html
from a markdown file:
import filepath, { html } from './foo.md'
// The path to markdown file
console.log(filepath)
// HTML string
console.log(html)
v12.1.0
New feature
JavaScript files ending with .eval.{js,jsx,ts,tsx}
will be evaluated at compile time (i.e. pre-evaluated by Node.js rather than your browser):
users.eval.js
:
import fetch from 'node-fetch'
export default async function() {
const users = await fetch('https://api.github.com/users').then(res => res.json())
return { users }
}
index.js
:
import { users } from './users.eval'
console.log(users)
// [{ login: 'mojombo' ...}]
Notably:
- The file to eval must have a default export (
export default
ormodule.exports
ormodule.exports.default
) which is a function returning an object which can be serialized byJSON.stringify
. (Or a Promise which resolves to such object.) - Tree shaking work well with the data imported from the evaluated file since it is treated as JSON module by webpack.
- You can use
this.addDependency(filepath)
to make webpack watch specific files for changes.this
is basically webpack's LoaderContext.
How to turn off this feature:
// poi.config.js
module.exports = {
chainWebpack(config) {
config.module.rules.delete('eval')
}
}
v12.0.0
Check out https://poi.js.org
v12.0.0-beta.9
😎 New Features
Now it's easier to write plugin names:
// poi.config.js
module.exports = {
plugins: [
{
// equivalent to `poi-plugin-typescript`
resolve: 'typescript'
},
{
// equivalent to `@org/poi-plugin-typescript`
resolve: '@org/typescript'
},
{
// equivalent to `@poi/plugin-typescript`
resolve: '@poi/typescript'
}
]
}
You can also use CLI flag to add plugins: --plugin <name>
or --plugins <name>
. If the plugins added from CLI flags are already added from config file, they will be ignored.